<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!-- The GNU coding standards, last updated May 10, 2011.

Copyright C 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts.  A copy of the license is included in the section entitled
"GNU Free Documentation License".
 -->
<!-- Created on August 29, 2011 by texi2html 1.82
texi2html was written by: 
            Lionel Cons <Lionel.Cons@cern.ch> (original author)
            Karl Berry  <karl@freefriends.org>
            Olaf Bachmann <obachman@mathematik.uni-kl.de>
            and many others.
Maintained by: Many creative people.
Send bugs and suggestions to <texi2html-bug@nongnu.org>
-->
<head>
<title>GNU Coding Standards</title>

<meta name="description" content="GNU Coding Standards">
<meta name="keywords" content="GNU Coding Standards">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 1.82">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
pre.display {font-family: serif}
pre.format {font-family: serif}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: serif; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: serif; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.roman {font-family:serif; font-weight:normal;}
span.sansserif {font-family:sans-serif; font-weight:normal;}
ul.toc {list-style: none}
-->
</style>


</head>

<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">

<a name="Top"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="GNU-Coding-Standards"></a>
<h1 class="settitle">GNU Coding Standards</h1>

<p>The GNU coding standards, last updated May 10, 2011.
</p>
<p>Copyright &copy; 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
</p>
<p>Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts.  A copy of the license is included in the section entitled
&ldquo;GNU Free Documentation License&rdquo;.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Preface">1. About the GNU Coding Standards</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Legal-Issues">2. Keeping Free Software Free</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                Keeping free software free.
</td></tr>
<tr><td align="left" valign="top"><a href="#Design-Advice">3. General Program Design</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">               General program design.
</td></tr>
<tr><td align="left" valign="top"><a href="#Program-Behavior">4. Program Behavior for All Programs</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">            Program behavior for all programs
</td></tr>
<tr><td align="left" valign="top"><a href="#Writing-C">5. Making The Best Use of C</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                   Making the best use of C.
</td></tr>
<tr><td align="left" valign="top"><a href="#Documentation">6. Documenting Programs</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">               Documenting programs.
</td></tr>
<tr><td align="left" valign="top"><a href="#Managing-Releases">7. The Release Process</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">           The release process.
</td></tr>
<tr><td align="left" valign="top"><a href="#References">8. References to Non-Free Software and Documentation</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                  Mentioning non-free software or documentation.
</td></tr>
<tr><td align="left" valign="top"><a href="#GNU-Free-Documentation-License">A. GNU Free Documentation License</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">  Copying and sharing this manual.
</td></tr>
<tr><td align="left" valign="top"><a href="#Index">Index</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
</pre></th></tr></table>

<hr size="1">
<a name="Preface"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Top" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Legal-Issues" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Legal-Issues" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="About-the-GNU-Coding-Standards"></a>
<h1 class="chapter">1. About the GNU Coding Standards</h1>

<p>The GNU Coding Standards were written by Richard Stallman and other GNU
Project volunteers.  Their purpose is to make the GNU system clean,
consistent, and easy to install.  This document can also be read as a
guide to writing portable, robust and reliable programs.  It focuses on
programs written in C, but many of the rules and principles are useful
even if you write in another programming language.  The rules often
state reasons for writing in a certain way.
</p>
<a name="index-where-to-obtain-standards_002etexi"></a>
<a name="index-downloading-this-manual"></a>
<p>If you did not obtain this file directly from the GNU project and
recently, please check for a newer version.  You can get the GNU
Coding Standards from the GNU web server in many
different formats, including the Texinfo source, PDF, HTML, DVI, plain
text, and more, at: <a href="http://www.gnu.org/prep/standards/">http://www.gnu.org/prep/standards/</a>.
</p>
<p>If you are maintaining an official GNU package, in addition to this
document, please read and follow the GNU maintainer information
(see <a href="maintain.html#Top">(maintain)Top</a> section &lsquo;Contents&rsquo; in <cite>Information for Maintainers of GNU Software</cite>).
</p>
<a name="index-gnustandards_002dcommit_0040gnu_002eorg-mailing-list"></a>
<p>If you want to receive diffs for every change to these GNU documents,
join the mailing list <code>gnustandards-commit@gnu.org</code>, via the web
interface at
<a href="http://lists.gnu.org/mailman/listinfo/gnustandards-commit">http://lists.gnu.org/mailman/listinfo/gnustandards-commit</a>.
Archives are also available there.
</p>
<a name="index-bug_002dstandards_0040gnu_002eorg-email-address"></a>
<a name="index-Savannah-repository-for-gnustandards"></a>
<a name="index-gnustandards-project-repository"></a>
<p>Please send corrections or suggestions for this document to
<a href="mailto:bug-standards@gnu.org">bug-standards@gnu.org</a>.  If you make a suggestion, please
include a suggested new wording for it, to help us consider the
suggestion efficiently.  We prefer a context diff to the Texinfo
source, but if that&rsquo;s difficult for you, you can make a context diff
for some other version of this document, or propose it in any way that
makes it clear.  The source repository for this document can be found
at <a href="http://savannah.gnu.org/projects/gnustandards">http://savannah.gnu.org/projects/gnustandards</a>.
</p>
<p>These standards cover the minimum of what is important when writing a
GNU package.  Likely, the need for additional standards will come up.
Sometimes, you might suggest that such standards be added to this
document.  If you think your standards would be generally useful, please
do suggest them.
</p>
<p>You should also set standards for your package on many questions not
addressed or not firmly specified here.  The most important point is to
be self-consistent&mdash;try to stick to the conventions you pick, and try
to document them as much as possible.  That way, your program will be
more maintainable by others.
</p>
<p>The GNU Hello program serves as an example of how to follow the GNU
coding standards for a trivial program.
<a href="http://www.gnu.org/software/hello/hello.html">http://www.gnu.org/software/hello/hello.html</a>.
</p>
<p>This release of the GNU Coding Standards was last updated
May 10, 2011.
</p>

<hr size="6">
<a name="Legal-Issues"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Preface" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Reading-Non_002dFree-Code" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Preface" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Design-Advice" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Keeping-Free-Software-Free"></a>
<h1 class="chapter">2. Keeping Free Software Free</h1>
<a name="index-legal-aspects"></a>

<p>This chapter discusses how you can make sure that GNU software
avoids legal difficulties, and other related issues.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Reading-Non_002dFree-Code">2.1 Referring to Proprietary Programs</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">       Referring to proprietary programs.
</td></tr>
<tr><td align="left" valign="top"><a href="#Contributions">2.2 Accepting Contributions</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">               Accepting contributions.
</td></tr>
<tr><td align="left" valign="top"><a href="#Trademarks">2.3 Trademarks</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                  How we deal with trademark issues.
</td></tr>
</table>

<hr size="6">
<a name="Reading-Non_002dFree-Code"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Legal-Issues" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Contributions" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Legal-Issues" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Legal-Issues" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Design-Advice" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Referring-to-Proprietary-Programs"></a>
<h2 class="section">2.1 Referring to Proprietary Programs</h2>
<a name="index-proprietary-programs"></a>
<a name="index-avoiding-proprietary-code"></a>

<p>Don&rsquo;t in any circumstances refer to Unix source code for or during
your work on GNU!  (Or to any other proprietary programs.)
</p>
<p>If you have a vague recollection of the internals of a Unix program,
this does not absolutely mean you can&rsquo;t write an imitation of it, but
do try to organize the imitation internally along different lines,
because this is likely to make the details of the Unix version
irrelevant and dissimilar to your results.
</p>
<p>For example, Unix utilities were generally optimized to minimize
memory use; if you go for speed instead, your program will be very
different.  You could keep the entire input file in memory and scan it
there instead of using stdio.  Use a smarter algorithm discovered more
recently than the Unix program.  Eliminate use of temporary files.  Do
it in one pass instead of two (we did this in the assembler).
</p>
<p>Or, on the contrary, emphasize simplicity instead of speed.  For some
applications, the speed of today&rsquo;s computers makes simpler algorithms
adequate.
</p>
<p>Or go for generality.  For example, Unix programs often have static
tables or fixed-size strings, which make for arbitrary limits; use
dynamic allocation instead.  Make sure your program handles NULs and
other funny characters in the input files.  Add a programming language
for extensibility and write part of the program in that language.
</p>
<p>Or turn some parts of the program into independently usable libraries.
Or use a simple garbage collector instead of tracking precisely when
to free memory, or use a new GNU facility such as obstacks.
</p>

<hr size="6">
<a name="Contributions"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Reading-Non_002dFree-Code" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Trademarks" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Legal-Issues" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Legal-Issues" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Design-Advice" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Accepting-Contributions"></a>
<h2 class="section">2.2 Accepting Contributions</h2>
<a name="index-legal-papers"></a>
<a name="index-accepting-contributions"></a>

<p>If the program you are working on is copyrighted by the Free Software
Foundation, then when someone else sends you a piece of code to add to
the program, we need legal papers to use it&mdash;just as we asked you to
sign papers initially.  <em>Each</em> person who makes a nontrivial
contribution to a program must sign some sort of legal papers in order
for us to have clear title to the program; the main author alone is not
enough.
</p>
<p>So, before adding in any contributions from other people, please tell
us, so we can arrange to get the papers.  Then wait until we tell you
that we have received the signed papers, before you actually use the
contribution.
</p>
<p>This applies both before you release the program and afterward.  If
you receive diffs to fix a bug, and they make significant changes, we
need legal papers for that change.
</p>
<p>This also applies to comments and documentation files.  For copyright
law, comments and code are just text.  Copyright applies to all kinds of
text, so we need legal papers for all kinds.
</p>
<p>We know it is frustrating to ask for legal papers; it&rsquo;s frustrating for
us as well.  But if you don&rsquo;t wait, you are going out on a limb&mdash;for
example, what if the contributor&rsquo;s employer won&rsquo;t sign a disclaimer?
You might have to take that code out again!
</p>
<p>You don&rsquo;t need papers for changes of a few lines here or there, since
they are not significant for copyright purposes.  Also, you don&rsquo;t need
papers if all you get from the suggestion is some ideas, not actual code
which you use.  For example, if someone sent you one implementation, but
you write a different implementation of the same idea, you don&rsquo;t need to
get papers.
</p>
<p>The very worst thing is if you forget to tell us about the other
contributor.  We could be very embarrassed in court some day as a
result.
</p>
<p>We have more detailed advice for maintainers of GNU packages.  If you
have reached the stage of maintaining a GNU program (whether released
or not), please take a look: see <a href="maintain.html#Legal-Matters">(maintain)Legal Matters</a> section &lsquo;Legal Matters&rsquo; in <cite>Information for GNU Maintainers</cite>.
</p>

<hr size="6">
<a name="Trademarks"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Contributions" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Design-Advice" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Legal-Issues" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Legal-Issues" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Design-Advice" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Trademarks-1"></a>
<h2 class="section">2.3 Trademarks</h2>
<a name="index-trademarks"></a>

<p>Please do not include any trademark acknowledgements in GNU software
packages or documentation.
</p>
<p>Trademark acknowledgements are the statements that such-and-such is a
trademark of so-and-so.  The GNU Project has no objection to the basic
idea of trademarks, but these acknowledgements feel like kowtowing,
and there is no legal requirement for them, so we don&rsquo;t use them.
</p>
<p>What is legally required, as regards other people&rsquo;s trademarks, is to
avoid using them in ways which a reader might reasonably understand as
naming or labeling our own programs or activities.  For example, since
&ldquo;Objective C&rdquo; is (or at least was) a trademark, we made sure to say
that we provide a &ldquo;compiler for the Objective C language&rdquo; rather
than an &ldquo;Objective C compiler&rdquo;.  The latter would have been meant as
a shorter way of saying the former, but it does not explicitly state
the relationship, so it could be misinterpreted as using &ldquo;Objective
C&rdquo; as a label for the compiler rather than for the language.
</p>
<p>Please don&rsquo;t use &ldquo;win&rdquo; as an abbreviation for Microsoft Windows in
GNU software or documentation.  In hacker terminology, calling
something a &ldquo;win&rdquo; is a form of praise.  If you wish to praise
Microsoft Windows when speaking on your own, by all means do so, but
not in GNU software.  Usually we write the name &ldquo;Windows&rdquo; in full,
but when brevity is very important (as in file names and sometimes
symbol names), we abbreviate it to &ldquo;w&rdquo;.  For instance, the files and
functions in Emacs that deal with Windows start with &lsquo;<samp>w32</samp>&rsquo;.
</p>
<hr size="6">
<a name="Design-Advice"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Trademarks" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Source-Language" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Legal-Issues" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="General-Program-Design"></a>
<h1 class="chapter">3. General Program Design</h1>
<a name="index-program-design"></a>

<p>This chapter discusses some of the issues you should take into
account when designing your program.
</p>


<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Source-Language">3.1 Which Languages to Use</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">             Which languages to use.
</td></tr>
<tr><td align="left" valign="top"><a href="#Compatibility">3.2 Compatibility with Other Implementations</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">               Compatibility with other implementations.
</td></tr>
<tr><td align="left" valign="top"><a href="#Using-Extensions">3.3 Using Non-standard Features</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">            Using non-standard features.
</td></tr>
<tr><td align="left" valign="top"><a href="#Standard-C">3.4 Standard C and Pre-Standard C</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                  Using standard C features.
</td></tr>
<tr><td align="left" valign="top"><a href="#Conditional-Compilation">3.5 Conditional Compilation</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">     Compiling code only if a conditional is true.
</td></tr>
</table>

<hr size="6">
<a name="Source-Language"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Design-Advice" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Compatibility" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Design-Advice" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Design-Advice" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Which-Languages-to-Use"></a>
<h2 class="section">3.1 Which Languages to Use</h2>
<a name="index-programming-languages"></a>

<p>When you want to use a language that gets compiled and runs at high
speed, the best language to use is C.  Using another language is like
using a non-standard feature: it will cause trouble for users.  Even if
GCC supports the other language, users may find it inconvenient to have
to install the compiler for that other language in order to build your
program.  For example, if you write your program in C++, people will
have to install the GNU C++ compiler in order to compile your program.
</p>
<p>C has one other advantage over C++ and other compiled languages: more
people know C, so more people will find it easy to read and modify the
program if it is written in C.
</p>
<p>So in general it is much better to use C, rather than the
comparable alternatives.
</p>
<p>But there are two exceptions to that conclusion:
</p>
<ul>
<li>
It is no problem to use another language to write a tool specifically
intended for use with that language.  That is because the only people
who want to build the tool will be those who have installed the other
language anyway.

</li><li>
If an application is of interest only to a narrow part of the community,
then the question of which language it is written in has less effect on
other people, so you may as well please yourself.
</li></ul>

<p>Many programs are designed to be extensible: they include an interpreter
for a language that is higher level than C.  Often much of the program
is written in that language, too.  The Emacs editor pioneered this
technique.
</p>
<a name="index-Guile"></a>
<a name="index-GNOME-and-Guile"></a>
<p>The standard extensibility interpreter for GNU software is Guile
(<a href="http://www.gnu.org/software/guile/">http://www.gnu.org/software/guile/</a>), which implements the
language Scheme (an especially clean and simple dialect of Lisp).
Guile also includes bindings for GTK+/GNOME, making it practical to
write modern GUI functionality within Guile.  We don&rsquo;t reject programs
written in other &ldquo;scripting languages&rdquo; such as Perl and Python, but
using Guile is very important for the overall consistency of the GNU
system.
</p>

<hr size="6">
<a name="Compatibility"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Source-Language" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Using-Extensions" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Design-Advice" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Design-Advice" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Compatibility-with-Other-Implementations"></a>
<h2 class="section">3.2 Compatibility with Other Implementations</h2>
<a name="index-compatibility-with-C-and-POSIX-standards"></a>
<a name="index-POSIX-compatibility"></a>

<p>With occasional exceptions, utility programs and libraries for GNU
should be upward compatible with those in Berkeley Unix, and upward
compatible with Standard C if Standard C specifies their
behavior, and upward compatible with <small>POSIX</small> if <small>POSIX</small> specifies
their behavior.
</p>
<p>When these standards conflict, it is useful to offer compatibility
modes for each of them.
</p>
<a name="index-options-for-compatibility"></a>
<p>Standard C and <small>POSIX</small> prohibit many kinds of extensions.  Feel
free to make the extensions anyway, and include a &lsquo;<samp>--ansi</samp>&rsquo;,
&lsquo;<samp>--posix</samp>&rsquo;, or &lsquo;<samp>--compatible</samp>&rsquo; option to turn them off.
However, if the extension has a significant chance of breaking any real
programs or scripts, then it is not really upward compatible.  So you
should try to redesign its interface to make it upward compatible.
</p>
<a name="index-POSIXLY_005fCORRECT_002c-environment-variable"></a>
<p>Many GNU programs suppress extensions that conflict with <small>POSIX</small> if the
environment variable <code>POSIXLY_CORRECT</code> is defined (even if it is
defined with a null value).  Please make your program recognize this
variable if appropriate.
</p>
<p>When a feature is used only by users (not by programs or command
files), and it is done poorly in Unix, feel free to replace it
completely with something totally different and better.  (For example,
<code>vi</code> is replaced with Emacs.)  But it is nice to offer a compatible
feature as well.  (There is a free <code>vi</code> clone, so we offer it.)
</p>
<p>Additional useful features are welcome regardless of whether
there is any precedent for them.
</p>
<hr size="6">
<a name="Using-Extensions"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Compatibility" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Standard-C" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Design-Advice" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Design-Advice" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Using-Non_002dstandard-Features"></a>
<h2 class="section">3.3 Using Non-standard Features</h2>
<a name="index-non_002dstandard-extensions"></a>

<p>Many GNU facilities that already exist support a number of convenient
extensions over the comparable Unix facilities.  Whether to use these
extensions in implementing your program is a difficult question.
</p>
<p>On the one hand, using the extensions can make a cleaner program.
On the other hand, people will not be able to build the program
unless the other GNU tools are available.  This might cause the
program to work on fewer kinds of machines.
</p>
<p>With some extensions, it might be easy to provide both alternatives.
For example, you can define functions with a &ldquo;keyword&rdquo; <code>INLINE</code>
and define that as a macro to expand into either <code>inline</code> or
nothing, depending on the compiler.
</p>
<p>In general, perhaps it is best not to use the extensions if you can
straightforwardly do without them, but to use the extensions if they
are a big improvement.
</p>
<p>An exception to this rule are the large, established programs (such as
Emacs) which run on a great variety of systems.  Using GNU extensions in
such programs would make many users unhappy, so we don&rsquo;t do that.
</p>
<p>Another exception is for programs that are used as part of compilation:
anything that must be compiled with other compilers in order to
bootstrap the GNU compilation facilities.  If these require the GNU
compiler, then no one can compile them without having them installed
already.  That would be extremely troublesome in certain cases.
</p>
<hr size="6">
<a name="Standard-C"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Using-Extensions" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Conditional-Compilation" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Design-Advice" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Design-Advice" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Standard-C-and-Pre_002dStandard-C"></a>
<h2 class="section">3.4 Standard C and Pre-Standard C</h2>
<a name="index-ANSI-C-standard"></a>

<p>1989 Standard C is widespread enough now that it is ok to use its
features in new programs.  There is one exception: do not ever use the
&ldquo;trigraph&rdquo; feature of Standard C.
</p>
<p>1999 Standard C is not widespread yet, so please do not require its
features in programs.  It is ok to use its features if they are present.
</p>
<p>However, it is easy to support pre-standard compilers in most programs,
so if you know how to do that, feel free.  If a program you are
maintaining has such support, you should try to keep it working.
</p>
<a name="index-function-prototypes"></a>
<p>To support pre-standard C, instead of writing function definitions in
standard prototype form,
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">int
foo (int x, int y)
&hellip;
</pre></td></tr></table>

<p>write the definition in pre-standard style like this,
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">int
foo (x, y)
     int x, y;
&hellip;
</pre></td></tr></table>

<p>and use a separate declaration to specify the argument prototype:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">int foo (int, int);
</pre></td></tr></table>

<p>You need such a declaration anyway, in a header file, to get the benefit
of prototypes in all the files where the function is called.  And once
you have the declaration, you normally lose nothing by writing the
function definition in the pre-standard style.
</p>
<p>This technique does not work for integer types narrower than <code>int</code>.
If you think of an argument as being of a type narrower than <code>int</code>,
declare it as <code>int</code> instead.
</p>
<p>There are a few special cases where this technique is hard to use.  For
example, if a function argument needs to hold the system type
<code>dev_t</code>, you run into trouble, because <code>dev_t</code> is shorter than
<code>int</code> on some machines; but you cannot use <code>int</code> instead,
because <code>dev_t</code> is wider than <code>int</code> on some machines.  There
is no type you can safely use on all machines in a non-standard
definition.  The only way to support non-standard C and pass such an
argument is to check the width of <code>dev_t</code> using Autoconf and choose
the argument type accordingly.  This may not be worth the trouble.
</p>
<p>In order to support pre-standard compilers that do not recognize
prototypes, you may want to use a preprocessor macro like this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">/* Declare the prototype for a general external function.  */
#if defined (__STDC__) || defined (WINDOWSNT)
#define P_(proto) proto
#else
#define P_(proto) ()
#endif
</pre></td></tr></table>

<hr size="6">
<a name="Conditional-Compilation"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Standard-C" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Design-Advice" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Design-Advice" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Conditional-Compilation-1"></a>
<h2 class="section">3.5 Conditional Compilation</h2>

<p>When supporting configuration options already known when building your
program we prefer using <code>if (... )</code> over conditional compilation,
as in the former case the compiler is able to perform more extensive
checking of all possible code paths.
</p>
<p>For example, please write
</p>
<table><tr><td>&nbsp;</td><td><pre class="smallexample">  if (HAS_FOO)
    ...
  else
    ...
</pre></td></tr></table>

<p>instead of:
</p>
<table><tr><td>&nbsp;</td><td><pre class="smallexample">  #ifdef HAS_FOO
    ...
  #else
    ...
  #endif
</pre></td></tr></table>

<p>A modern compiler such as GCC will generate exactly the same code in
both cases, and we have been using similar techniques with good success
in several projects.  Of course, the former method assumes that
<code>HAS_FOO</code> is defined as either 0 or 1.
</p>
<p>While this is not a silver bullet solving all portability problems,
and is not always appropriate, following this policy would have saved
GCC developers many hours, or even days, per year.
</p>
<p>In the case of function-like macros like <code>REVERSIBLE_CC_MODE</code> in
GCC which cannot be simply used in <code>if (...)</code> statements, there is
an easy workaround.  Simply introduce another macro
<code>HAS_REVERSIBLE_CC_MODE</code> as in the following example:
</p>
<table><tr><td>&nbsp;</td><td><pre class="smallexample">  #ifdef REVERSIBLE_CC_MODE
  #define HAS_REVERSIBLE_CC_MODE 1
  #else
  #define HAS_REVERSIBLE_CC_MODE 0
  #endif
</pre></td></tr></table>

<hr size="6">
<a name="Program-Behavior"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Conditional-Compilation" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Non_002dGNU-Standards" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Design-Advice" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Program-Behavior-for-All-Programs"></a>
<h1 class="chapter">4. Program Behavior for All Programs</h1>

<p>This chapter describes conventions for writing robust
software.  It also describes general standards for error messages, the
command line interface, and how libraries should behave.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Non_002dGNU-Standards">4.1 Non-GNU Standards</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">           We consider standards such as POSIX;
                                  we don&rsquo;t &quot;obey&quot; them.
</td></tr>
<tr><td align="left" valign="top"><a href="#Semantics">4.2 Writing Robust Programs</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                   Writing robust programs.
</td></tr>
<tr><td align="left" valign="top"><a href="#Libraries">4.3 Library Behavior</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                   Library behavior.
</td></tr>
<tr><td align="left" valign="top"><a href="#Errors">4.4 Formatting Error Messages</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                      Formatting error messages.
</td></tr>
<tr><td align="left" valign="top"><a href="#User-Interfaces">4.5 Standards for Interfaces Generally</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">             Standards about interfaces generally.
</td></tr>
<tr><td align="left" valign="top"><a href="#Graphical-Interfaces">4.6 Standards for Graphical Interfaces</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">        Standards for graphical interfaces.
</td></tr>
<tr><td align="left" valign="top"><a href="#Command_002dLine-Interfaces">4.7 Standards for Command Line Interfaces</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">     Standards for command line interfaces.
</td></tr>
<tr><td align="left" valign="top"><a href="#Dynamic-Plug_002dIn-Interfaces">4.8 Standards for Dynamic Plug-in Interfaces</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">  Standards for dynamic plug-in interfaces.
</td></tr>
<tr><td align="left" valign="top"><a href="#Option-Table">4.9 Table of Long Options</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                Table of long options.
</td></tr>
<tr><td align="left" valign="top"><a href="#OID-Allocations">4.10 OID Allocations</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">             Table of OID slots for GNU.
</td></tr>
<tr><td align="left" valign="top"><a href="#Memory-Usage">4.11 Memory Usage</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                When and how to care about memory needs.
</td></tr>
<tr><td align="left" valign="top"><a href="#File-Usage">4.12 File Usage</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                  Which files to use, and where.
</td></tr>
</table>

<hr size="6">
<a name="Non_002dGNU-Standards"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Program-Behavior" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Semantics" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Non_002dGNU-Standards-1"></a>
<h2 class="section">4.1 Non-GNU Standards</h2>

<p>The GNU Project regards standards published by other organizations as
suggestions, not orders.  We consider those standards, but we do not
&ldquo;obey&rdquo; them.  In developing a GNU program, you should implement
an outside standard&rsquo;s specifications when that makes the GNU system
better overall in an objective sense.  When it doesn&rsquo;t, you shouldn&rsquo;t.
</p>
<p>In most cases, following published standards is convenient for
users&mdash;it means that their programs or scripts will work more
portably.  For instance, GCC implements nearly all the features of
Standard C as specified by that standard.  C program developers would
be unhappy if it did not.  And GNU utilities mostly follow
specifications of POSIX.2; shell script writers and users would be
unhappy if our programs were incompatible.
</p>
<p>But we do not follow either of these specifications rigidly, and there
are specific points on which we decided not to follow them, so as to
make the GNU system better for users.
</p>
<p>For instance, Standard C says that nearly all extensions to C are
prohibited.  How silly!  GCC implements many extensions, some of which
were later adopted as part of the standard.  If you want these
constructs to give an error message as &ldquo;required&rdquo; by the standard,
you must specify &lsquo;<samp>--pedantic</samp>&rsquo;, which was implemented only so that
we can say &ldquo;GCC is a 100% implementation of the standard,&rdquo; not
because there is any reason to actually use it.
</p>
<p>POSIX.2 specifies that &lsquo;<samp>df</samp>&rsquo; and &lsquo;<samp>du</samp>&rsquo; must output sizes by
default in units of 512 bytes.  What users want is units of 1k, so
that is what we do by default.  If you want the ridiculous behavior
&ldquo;required&rdquo; by POSIX, you must set the environment variable
&lsquo;<samp>POSIXLY_CORRECT</samp>&rsquo; (which was originally going to be named
&lsquo;<samp>POSIX_ME_HARDER</samp>&rsquo;).
</p>
<p>GNU utilities also depart from the letter of the POSIX.2 specification
when they support long-named command-line options, and intermixing
options with ordinary arguments.  This minor incompatibility with
POSIX is never a problem in practice, and it is very useful.
</p>
<p>In particular, don&rsquo;t reject a new feature, or remove an old one,
merely because a standard says it is &ldquo;forbidden&rdquo; or &ldquo;deprecated.&rdquo;
</p>

<hr size="6">
<a name="Semantics"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Non_002dGNU-Standards" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Libraries" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Writing-Robust-Programs"></a>
<h2 class="section">4.2 Writing Robust Programs</h2>

<a name="index-arbitrary-limits-on-data"></a>
<p>Avoid arbitrary limits on the length or number of <em>any</em> data
structure, including file names, lines, files, and symbols, by allocating
all data structures dynamically.  In most Unix utilities, &ldquo;long lines
are silently truncated&rdquo;.  This is not acceptable in a GNU utility.
</p>
<a name="index-NUL-characters"></a>
<a name="index-libiconv"></a>
<p>Utilities reading files should not drop NUL characters, or any other
nonprinting characters <em>including those with codes above 0177</em>.
The only sensible exceptions would be utilities specifically intended
for interface to certain types of terminals or printers
that can&rsquo;t handle those characters.
Whenever possible, try to make programs work properly with
sequences of bytes that represent multibyte characters, using encodings
such as UTF-8 and others.
</p>
<a name="index-error-messages"></a>
<p>Check every system call for an error return, unless you know you wish
to ignore errors.  Include the system error text (from <code>perror</code>,
<code>strerror</code>, or equivalent) in <em>every</em> error message
resulting from a failing system call, as well as the name of the file
if any and the name of the utility.  Just &ldquo;cannot open foo.c&rdquo; or
&ldquo;stat failed&rdquo; is not sufficient.
</p>
<a name="index-malloc-return-value"></a>
<a name="index-memory-allocation-failure"></a>
<p>Check every call to <code>malloc</code> or <code>realloc</code> to see if it
returned zero.  Check <code>realloc</code> even if you are making the block
smaller; in a system that rounds block sizes to a power of 2,
<code>realloc</code> may get a different block if you ask for less space.
</p>
<p>In Unix, <code>realloc</code> can destroy the storage block if it returns
zero.  GNU <code>realloc</code> does not have this bug: if it fails, the
original block is unchanged.  Feel free to assume the bug is fixed.  If
you wish to run your program on Unix, and wish to avoid lossage in this
case, you can use the GNU <code>malloc</code>.
</p>
<p>You must expect <code>free</code> to alter the contents of the block that was
freed.  Anything you want to fetch from the block, you must fetch before
calling <code>free</code>.
</p>
<p>If <code>malloc</code> fails in a noninteractive program, make that a fatal
error.  In an interactive program (one that reads commands from the
user), it is better to abort the command and return to the command
reader loop.  This allows the user to kill other processes to free up
virtual memory, and then try the command again.
</p>
<a name="index-command_002dline-arguments_002c-decoding"></a>
<p>Use <code>getopt_long</code> to decode arguments, unless the argument syntax
makes this unreasonable.
</p>
<p>When static storage is to be written in during program execution, use
explicit C code to initialize it.  Reserve C initialized declarations
for data that will not be changed.
</p>
<p>Try to avoid low-level interfaces to obscure Unix data structures (such
as file directories, utmp, or the layout of kernel memory), since these
are less likely to work compatibly.  If you need to find all the files
in a directory, use <code>readdir</code> or some other high-level interface.
These are supported compatibly by GNU.
</p>
<a name="index-signal-handling"></a>
<p>The preferred signal handling facilities are the BSD variant of
<code>signal</code>, and the <small>POSIX</small> <code>sigaction</code> function; the
alternative USG <code>signal</code> interface is an inferior design.
</p>
<p>Nowadays, using the <small>POSIX</small> signal functions may be the easiest way
to make a program portable.  If you use <code>signal</code>, then on GNU/Linux
systems running GNU libc version 1, you should include
&lsquo;<tt>bsd/signal.h</tt>&rsquo; instead of &lsquo;<tt>signal.h</tt>&rsquo;, so as to get BSD
behavior.  It is up to you whether to support systems where
<code>signal</code> has only the USG behavior, or give up on them.
</p>
<a name="index-impossible-conditions"></a>
<p>In error checks that detect &ldquo;impossible&rdquo; conditions, just abort.
There is usually no point in printing any message.  These checks
indicate the existence of bugs.  Whoever wants to fix the bugs will have
to read the source code and run a debugger.  So explain the problem with
comments in the source.  The relevant data will be in variables, which
are easy to examine with the debugger, so there is no point moving them
elsewhere.
</p>
<p>Do not use a count of errors as the exit status for a program.
<em>That does not work</em>, because exit status values are limited to 8
bits (0 through 255).  A single run of the program might have 256
errors; if you try to return 256 as the exit status, the parent process
will see 0 as the status, and it will appear that the program succeeded.
</p>
<a name="index-temporary-files"></a>
<a name="index-TMPDIR-environment-variable"></a>
<p>If you make temporary files, check the <code>TMPDIR</code> environment
variable; if that variable is defined, use the specified directory
instead of &lsquo;<tt>/tmp</tt>&rsquo;.
</p>
<p>In addition, be aware that there is a possible security problem when
creating temporary files in world-writable directories.  In C, you can
avoid this problem by creating temporary files in this manner:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">fd = open (filename, O_WRONLY | O_CREAT | O_EXCL, 0600);
</pre></td></tr></table>

<p>or by using the <code>mkstemps</code> function from Gnulib
(see <a href="gnulib.html#mkstemps">(gnulib)mkstemps</a> section &lsquo;mkstemps&rsquo; in <cite>Gnulib</cite>).
</p>
<p>In bash, use <code>set -C</code> (long name <code>noclobber</code>) to avoid this
problem.  In addition, the <code>mktemp</code> utility is a more general
solution for creating temporary files from shell scripts
(see <a href="coreutils.html#mktemp-invocation">(coreutils)mktemp invocation</a> section &lsquo;mktemp invocation&rsquo; in <cite>GNU Coreutils</cite>).
</p>

<hr size="6">
<a name="Libraries"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Semantics" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Errors" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Library-Behavior"></a>
<h2 class="section">4.3 Library Behavior</h2>
<a name="index-libraries"></a>

<p>Try to make library functions reentrant.  If they need to do dynamic
storage allocation, at least try to avoid any nonreentrancy aside from
that of <code>malloc</code> itself.
</p>
<p>Here are certain name conventions for libraries, to avoid name
conflicts.
</p>
<p>Choose a name prefix for the library, more than two characters long.
All external function and variable names should start with this
prefix.  In addition, there should only be one of these in any given
library member.  This usually means putting each one in a separate
source file.
</p>
<p>An exception can be made when two external symbols are always used
together, so that no reasonable program could use one without the
other; then they can both go in the same file.
</p>
<p>External symbols that are not documented entry points for the user
should have names beginning with &lsquo;<samp>_</samp>&rsquo;.  The &lsquo;<samp>_</samp>&rsquo; should be
followed by the chosen name prefix for the library, to prevent
collisions with other libraries.  These can go in the same files with
user entry points if you like.
</p>
<p>Static functions and variables can be used as you like and need not
fit any naming convention.
</p>
<hr size="6">
<a name="Errors"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Libraries" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#User-Interfaces" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Formatting-Error-Messages"></a>
<h2 class="section">4.4 Formatting Error Messages</h2>
<a name="index-formatting-error-messages"></a>
<a name="index-error-messages_002c-formatting"></a>

<p>Error messages from compilers should look like this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example"><var>source-file-name</var>:<var>lineno</var>: <var>message</var>
</pre></td></tr></table>

<p>If you want to mention the column number, use one of these formats:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example"><var>source-file-name</var>:<var>lineno</var>:<var>column</var>: <var>message</var>
<var>source-file-name</var>:<var>lineno</var>.<var>column</var>: <var>message</var>

</pre></td></tr></table>

<p>Line numbers should start from 1 at the beginning of the file, and
column numbers should start from 1 at the beginning of the line.  (Both
of these conventions are chosen for compatibility.)  Calculate column
numbers assuming that space and all ASCII printing characters have
equal width, and assuming tab stops every 8 columns.
</p>
<p>The error message can also give both the starting and ending positions
of the erroneous text.  There are several formats so that you can
avoid redundant information such as a duplicate line number.
Here are the possible formats:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example"><var>source-file-name</var>:<var>lineno-1</var>.<var>column-1</var>-<var>lineno-2</var>.<var>column-2</var>: <var>message</var>
<var>source-file-name</var>:<var>lineno-1</var>.<var>column-1</var>-<var>column-2</var>: <var>message</var>
<var>source-file-name</var>:<var>lineno-1</var>-<var>lineno-2</var>: <var>message</var>
</pre></td></tr></table>

<p>When an error is spread over several files, you can use this format:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example"><var>file-1</var>:<var>lineno-1</var>.<var>column-1</var>-<var>file-2</var>:<var>lineno-2</var>.<var>column-2</var>: <var>message</var>
</pre></td></tr></table>

<p>Error messages from other noninteractive programs should look like this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example"><var>program</var>:<var>source-file-name</var>:<var>lineno</var>: <var>message</var>
</pre></td></tr></table>

<p>when there is an appropriate source file, or like this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example"><var>program</var>: <var>message</var>
</pre></td></tr></table>

<p>when there is no relevant source file.
</p>
<p>If you want to mention the column number, use this format:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example"><var>program</var>:<var>source-file-name</var>:<var>lineno</var>:<var>column</var>: <var>message</var>
</pre></td></tr></table>

<p>In an interactive program (one that is reading commands from a
terminal), it is better not to include the program name in an error
message.  The place to indicate which program is running is in the
prompt or with the screen layout.  (When the same program runs with
input from a source other than a terminal, it is not interactive and
would do best to print error messages using the noninteractive style.)
</p>
<p>The string <var>message</var> should not begin with a capital letter when
it follows a program name and/or file name, because that isn&rsquo;t the
beginning of a sentence.  (The sentence conceptually starts at the
beginning of the line.)  Also, it should not end with a period.
</p>
<p>Error messages from interactive programs, and other messages such as
usage messages, should start with a capital letter.  But they should not
end with a period.
</p>
<hr size="6">
<a name="User-Interfaces"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Errors" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Graphical-Interfaces" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Standards-for-Interfaces-Generally"></a>
<h2 class="section">4.5 Standards for Interfaces Generally</h2>

<a name="index-program-name-and-its-behavior"></a>
<a name="index-behavior_002c-dependent-on-program_0027s-name"></a>
<p>Please don&rsquo;t make the behavior of a utility depend on the name used
to invoke it.  It is useful sometimes to make a link to a utility
with a different name, and that should not change what it does.
</p>
<p>Instead, use a run time option or a compilation switch or both
to select among the alternate behaviors.
</p>
<a name="index-output-device-and-program_0027s-behavior"></a>
<p>Likewise, please don&rsquo;t make the behavior of the program depend on the
type of output device it is used with.  Device independence is an
important principle of the system&rsquo;s design; do not compromise it merely
to save someone from typing an option now and then.  (Variation in error
message syntax when using a terminal is ok, because that is a side issue
that people do not depend on.)
</p>
<p>If you think one behavior is most useful when the output is to a
terminal, and another is most useful when the output is a file or a
pipe, then it is usually best to make the default behavior the one that
is useful with output to a terminal, and have an option for the other
behavior.
</p>
<p>Compatibility requires certain programs to depend on the type of output
device.  It would be disastrous if <code>ls</code> or <code>sh</code> did not do so
in the way all users expect.  In some of these cases, we supplement the
program with a preferred alternate version that does not depend on the
output device type.  For example, we provide a <code>dir</code> program much
like <code>ls</code> except that its default output format is always
multi-column format.
</p>

<hr size="6">
<a name="Graphical-Interfaces"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#User-Interfaces" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Command_002dLine-Interfaces" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Standards-for-Graphical-Interfaces"></a>
<h2 class="section">4.6 Standards for Graphical Interfaces</h2>
<a name="index-graphical-user-interface"></a>
<a name="index-interface-styles"></a>
<a name="index-user-interface-styles"></a>

<a name="index-GTK_002b"></a>
<p>When you write a program that provides a graphical user interface,
please make it work with the X Window System and the GTK+ toolkit
unless the functionality specifically requires some alternative (for
example, &ldquo;displaying jpeg images while in console mode&rdquo;).
</p>
<p>In addition, please provide a command-line interface to control the
functionality.  (In many cases, the graphical user interface can be a
separate program which invokes the command-line program.)  This is
so that the same jobs can be done from scripts.
</p>
<a name="index-CORBA"></a>
<a name="index-GNOME"></a>
<a name="index-D_002dbus"></a>
<a name="index-keyboard-interface"></a>
<a name="index-library-interface"></a>
<p>Please also consider providing a D-bus interface for use from other
running programs, such as within GNOME.  (GNOME used to use CORBA
for this, but that is being phased out.)  In addition, consider
providing a library interface (for use from C), and perhaps a
keyboard-driven console interface (for use by users from console
mode).  Once you are doing the work to provide the functionality and
the graphical interface, these won&rsquo;t be much extra work.
</p>

<hr size="6">
<a name="Command_002dLine-Interfaces"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Graphical-Interfaces" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#g_t_002d_002dversion" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Standards-for-Command-Line-Interfaces"></a>
<h2 class="section">4.7 Standards for Command Line Interfaces</h2>
<a name="index-command_002dline-interface"></a>

<a name="index-getopt"></a>
<p>It is a good idea to follow the <small>POSIX</small> guidelines for the
command-line options of a program.  The easiest way to do this is to use
<code>getopt</code> to parse them.  Note that the GNU version of <code>getopt</code>
will normally permit options anywhere among the arguments unless the
special argument &lsquo;<samp>--</samp>&rsquo; is used.  This is not what <small>POSIX</small>
specifies; it is a GNU extension.
</p>
<a name="index-long_002dnamed-options"></a>
<p>Please define long-named options that are equivalent to the
single-letter Unix-style options.  We hope to make GNU more user
friendly this way.  This is easy to do with the GNU function
<code>getopt_long</code>.
</p>
<p>One of the advantages of long-named options is that they can be
consistent from program to program.  For example, users should be able
to expect the &ldquo;verbose&rdquo; option of any GNU program which has one, to be
spelled precisely &lsquo;<samp>--verbose</samp>&rsquo;.  To achieve this uniformity, look at
the table of common long-option names when you choose the option names
for your program (see section <a href="#Option-Table">Table of Long Options</a>).
</p>
<p>It is usually a good idea for file names given as ordinary arguments to
be input files only; any output files would be specified using options
(preferably &lsquo;<samp>-o</samp>&rsquo; or &lsquo;<samp>--output</samp>&rsquo;).  Even if you allow an output
file name as an ordinary argument for compatibility, try to provide an
option as another way to specify it.  This will lead to more consistency
among GNU utilities, and fewer idiosyncrasies for users to remember.
</p>
<a name="index-standard-command_002dline-options"></a>
<a name="index-options_002c-standard-command_002dline"></a>
<a name="index-CGI-programs_002c-standard-options-for"></a>
<a name="index-PATH_005fINFO_002c-specifying-standard-options-as"></a>
<p>All programs should support two standard options: &lsquo;<samp>--version</samp>&rsquo;
and &lsquo;<samp>--help</samp>&rsquo;.  CGI programs should accept these as command-line
options, and also if given as the <code>PATH_INFO</code>; for instance,
visiting <a href="http://example.org/p.cgi/--help">http://example.org/p.cgi/--help</a> in a browser should
output the same information as invoking &lsquo;<samp>p.cgi --help</samp>&rsquo; from the
command line.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#g_t_002d_002dversion">4.7.1 &lsquo;<samp>--version</samp>&rsquo;</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">       The standard output for &ndash;version.
</td></tr>
<tr><td align="left" valign="top"><a href="#g_t_002d_002dhelp">4.7.2 &lsquo;<samp>--help</samp>&rsquo;</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">          The standard output for &ndash;help.
</td></tr>
</table>

<hr size="6">
<a name="g_t_002d_002dversion"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Command_002dLine-Interfaces" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#g_t_002d_002dhelp" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Command_002dLine-Interfaces" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="g_t_002d_002dversion-1"></a>
<h3 class="subsection">4.7.1 &lsquo;<samp>--version</samp>&rsquo;</h3>

<a name="index-_002d_002dversion-output"></a>

<p>The standard <code>--version</code> option should direct the program to
print information about its name, version, origin and legal status,
all on standard output, and then exit successfully.  Other options and
arguments should be ignored once this is seen, and the program should
not perform its normal function.
</p>
<a name="index-canonical-name-of-a-program"></a>
<a name="index-program_0027s-canonical-name"></a>
<p>The first line is meant to be easy for a program to parse; the version
number proper starts after the last space.  In addition, it contains
the canonical name for this program, in this format:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">GNU Emacs 19.30
</pre></td></tr></table>

<p>The program&rsquo;s name should be a constant string; <em>don&rsquo;t</em> compute it
from <code>argv[0]</code>.  The idea is to state the standard or canonical
name for the program, not its file name.  There are other ways to find
out the precise file name where a command is found in <code>PATH</code>.
</p>
<p>If the program is a subsidiary part of a larger package, mention the
package name in parentheses, like this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">emacsserver (GNU Emacs) 19.30
</pre></td></tr></table>

<p>If the package has a version number which is different from this
program&rsquo;s version number, you can mention the package version number
just before the close-parenthesis.
</p>
<p>If you <em>need</em> to mention the version numbers of libraries which
are distributed separately from the package which contains this program,
you can do so by printing an additional line of version info for each
library you want to mention.  Use the same format for these lines as for
the first line.
</p>
<p>Please do not mention all of the libraries that the program uses &ldquo;just
for completeness&rdquo;&mdash;that would produce a lot of unhelpful clutter.
Please mention library version numbers only if you find in practice that
they are very important to you in debugging.
</p>
<p>The following line, after the version number line or lines, should be a
copyright notice.  If more than one copyright notice is called for, put
each on a separate line.
</p>
<p>Next should follow a line stating the license, preferably using one of
abbrevations below, and a brief statement that the program is free
software, and that users are free to copy and change it.  Also mention
that there is no warranty, to the extent permitted by law.  See
recommended wording below.
</p>
<p>It is ok to finish the output with a list of the major authors of the
program, as a way of giving credit.
</p>
<p>Here&rsquo;s an example of output that follows these rules:
</p>
<table><tr><td>&nbsp;</td><td><pre class="smallexample">GNU hello 2.3
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later &lt;http://gnu.org/licenses/gpl.html&gt;
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
</pre></td></tr></table>

<p>You should adapt this to your program, of course, filling in the proper
year, copyright holder, name of program, and the references to
distribution terms, and changing the rest of the wording as necessary.
</p>
<p>This copyright notice only needs to mention the most recent year in
which changes were made&mdash;there&rsquo;s no need to list the years for previous
versions&rsquo; changes.  You don&rsquo;t have to mention the name of the program in
these notices, if that is inconvenient, since it appeared in the first
line.  (The rules are different for copyright notices in source files;
see <a href="maintain.html#Copyright-Notices">(maintain)Copyright Notices</a> section &lsquo;Copyright Notices&rsquo; in <cite>Information for GNU Maintainers</cite>.)
</p>
<p>Translations of the above lines must preserve the validity of the
copyright notices (see section <a href="#Internationalization">Internationalization</a>).  If the translation&rsquo;s
character set supports it, the &lsquo;<samp>(C)</samp>&rsquo; should be replaced with the
copyright symbol, as follows:
</p>
<p>&copy;
</p>
<p>Write the word &ldquo;Copyright&rdquo; exactly like that, in English.  Do not
translate it into another language.  International treaties recognize
the English word &ldquo;Copyright&rdquo;; translations into other languages do not
have legal significance.
</p>
<p>Finally, here is the table of our suggested license abbreviations.
Any abbreviation can be followed by &lsquo;<samp>v<var>version</var>[+]</samp>&rsquo;, meaning
that particular version, or later versions with the &lsquo;<samp>+</samp>&rsquo;, as shown
above.
</p>
<p>In the case of exceptions for extra permissions with the GPL, we use
&lsquo;<samp>/</samp>&rsquo; for a separator; the version number can follow the license
abbreviation as usual, as in the examples below.
</p>
<dl compact="compact">
<dt> GPL</dt>
<dd><p>GNU General Public License, <a href="http://www.gnu.org/licenses/gpl.html">http://www.gnu.org/licenses/gpl.html</a>.
</p>
</dd>
<dt> LGPL</dt>
<dd><p>GNU Lesser General Public License, <a href="http://www.gnu.org/licenses/lgpl.html">http://www.gnu.org/licenses/lgpl.html</a>.
</p>
</dd>
<dt> GPL/Ada</dt>
<dd><p>GNU GPL with the exception for Ada.
</p>
</dd>
<dt> Apache</dt>
<dd><p>The Apache Software Foundation license,
<a href="http://www.apache.org/licenses">http://www.apache.org/licenses</a>.
</p>
</dd>
<dt> Artistic</dt>
<dd><p>The Artistic license used for Perl, <a href="http://www.perlfoundation.org/legal">http://www.perlfoundation.org/legal</a>.
</p>
</dd>
<dt> Expat</dt>
<dd><p>The Expat license, <a href="http://www.jclark.com/xml/copying.txt">http://www.jclark.com/xml/copying.txt</a>.
</p>
</dd>
<dt> MPL</dt>
<dd><p>The Mozilla Public License, <a href="http://www.mozilla.org/MPL/">http://www.mozilla.org/MPL/</a>.
</p>
</dd>
<dt> OBSD</dt>
<dd><p>The original (4-clause) BSD license, incompatible with the GNU GPL
<a href="http://www.xfree86.org/3.3.6/COPYRIGHT2.html#6">http://www.xfree86.org/3.3.6/COPYRIGHT2.html#6</a>.
</p>
</dd>
<dt> PHP</dt>
<dd><p>The license used for PHP, <a href="http://www.php.net/license/">http://www.php.net/license/</a>.
</p>
</dd>
<dt> public domain</dt>
<dd><p>The non-license that is being in the public domain,
<a href="http://www.gnu.org/licenses/license-list.html#PublicDomain">http://www.gnu.org/licenses/license-list.html#PublicDomain</a>.
</p>
</dd>
<dt> Python</dt>
<dd><p>The license for Python, <a href="http://www.python.org/2.0.1/license.html">http://www.python.org/2.0.1/license.html</a>.
</p>
</dd>
<dt> RBSD</dt>
<dd><p>The revised (3-clause) BSD, compatible with the GNU GPL,<br>
<a href="http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5">http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5</a>.
</p>
</dd>
<dt> X11</dt>
<dd><p>The simple non-copyleft license used for most versions of the X Window
System, <a href="http://www.xfree86.org/3.3.6/COPYRIGHT2.html#3">http://www.xfree86.org/3.3.6/COPYRIGHT2.html#3</a>.
</p>
</dd>
<dt> Zlib</dt>
<dd><p>The license for Zlib, <a href="http://www.gzip.org/zlib/zlib_license.html">http://www.gzip.org/zlib/zlib_license.html</a>.
</p>
</dd>
</dl>

<p>More information about these licenses and many more are on the GNU
licensing web pages,
<a href="http://www.gnu.org/licenses/license-list.html">http://www.gnu.org/licenses/license-list.html</a>.
</p>

<hr size="6">
<a name="g_t_002d_002dhelp"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#g_t_002d_002dversion" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Dynamic-Plug_002dIn-Interfaces" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Command_002dLine-Interfaces" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="g_t_002d_002dhelp-1"></a>
<h3 class="subsection">4.7.2 &lsquo;<samp>--help</samp>&rsquo;</h3>

<a name="index-_002d_002dhelp-output"></a>

<p>The standard <code>--help</code> option should output brief documentation
for how to invoke the program, on standard output, then exit
successfully.  Other options and arguments should be ignored once this
is seen, and the program should not perform its normal function.
</p>
<a name="index-address-for-bug-reports"></a>
<a name="index-bug-reports"></a>
<p>Near the end of the &lsquo;<samp>--help</samp>&rsquo; option&rsquo;s output, please place lines
giving the email address for bug reports, the package&rsquo;s home page
(normally &lt;<code>http://www.gnu.org/software/<var>pkg</var></code>&gt;, and the
general page for help using GNU programs.  The format should be like this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">Report bugs to: <var>mailing-address</var>
<var>pkg</var> home page: &lt;http://www.gnu.org/software/<var>pkg</var>/&gt;
General help using GNU software: &lt;http://www.gnu.org/gethelp/&gt;
</pre></td></tr></table>

<p>It is ok to mention other appropriate mailing lists and web pages.
</p>

<hr size="6">
<a name="Dynamic-Plug_002dIn-Interfaces"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#g_t_002d_002dhelp" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Option-Table" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Standards-for-Dynamic-Plug_002din-Interfaces"></a>
<h2 class="section">4.8 Standards for Dynamic Plug-in Interfaces</h2>
<a name="index-plug_002dins"></a>
<a name="index-dynamic-plug_002dins"></a>

<p>Another aspect of keeping free programs free is encouraging
development of free plug-ins, and discouraging development of
proprietary plug-ins.  Many GNU programs will not have anything like
plug-ins at all, but those that do should follow these
practices.
</p>
<p>First, the general plug-in architecture design should closely tie the
plug-in to the original code, such that the plug-in and the base
program are parts of one extended program.  For GCC, for example,
plug-ins receive and modify GCC&rsquo;s internal data structures, and so
clearly form an extended program with the base GCC.
</p>
<a name="index-plugin_005fis_005fGPL_005fcompatible"></a>
<p>Second, you should require plug-in developers to affirm that their
plug-ins are released under an appropriate license.  This should be
enforced with a simple programmatic check.  For GCC, again for
example, a plug-in must define the global symbol
<code>plugin_is_GPL_compatible</code>, thus asserting that the plug-in is
released under a GPL-compatible license (see <a href="gccint.html#Plugins">(gccint)Plugins</a> section &lsquo;Plugins&rsquo; in <cite>GCC Internals</cite>).
</p>
<p>By adding this check to your program you are not creating a new legal
requirement.  The GPL itself requires plug-ins to be free software,
licensed compatibly.  As long as you have followed the first rule above
to keep plug-ins closely tied to your original program, the GPL and AGPL
already require those plug-ins to be released under a compatible
license.  The symbol definition in the plug-in&mdash;or whatever equivalent
works best in your program&mdash;makes it harder for anyone who might
distribute proprietary plug-ins to legally defend themselves.  If a case
about this got to court, we can point to that symbol as evidence that
the plug-in developer understood that the license had this requirement.
</p>

<hr size="6">
<a name="Option-Table"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Dynamic-Plug_002dIn-Interfaces" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#OID-Allocations" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Table-of-Long-Options"></a>
<h2 class="section">4.9 Table of Long Options</h2>
<a name="index-long-option-names"></a>
<a name="index-table-of-long-options"></a>

<p>Here is a table of long options used by GNU programs.  It is surely
incomplete, but we aim to list all the options that a new program might
want to be compatible with.  If you use names not already in the table,
please send <a href="mailto:bug-standards@gnu.org">bug-standards@gnu.org</a> a list of them, with their
meanings, so we can update the table.
</p>

<dl compact="compact">
<dt> &lsquo;<samp>after-date</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-N</samp>&rsquo; in <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>all</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-a</samp>&rsquo; in <code>du</code>, <code>ls</code>, <code>nm</code>, <code>stty</code>, <code>uname</code>,
and <code>unexpand</code>.
</p>
</dd>
<dt> &lsquo;<samp>all-text</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-a</samp>&rsquo; in <code>diff</code>.
</p>
</dd>
<dt> &lsquo;<samp>almost-all</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-A</samp>&rsquo; in <code>ls</code>.
</p>
</dd>
<dt> &lsquo;<samp>append</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-a</samp>&rsquo; in <code>etags</code>, <code>tee</code>, <code>time</code>;
&lsquo;<samp>-r</samp>&rsquo; in <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>archive</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-a</samp>&rsquo; in <code>cp</code>.
</p>
</dd>
<dt> &lsquo;<samp>archive-name</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-n</samp>&rsquo; in <code>shar</code>.
</p>
</dd>
<dt> &lsquo;<samp>arglength</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-l</samp>&rsquo; in <code>m4</code>.
</p>
</dd>
<dt> &lsquo;<samp>ascii</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-a</samp>&rsquo; in <code>diff</code>.
</p>
</dd>
<dt> &lsquo;<samp>assign</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-v</samp>&rsquo; in <code>gawk</code>.
</p>
</dd>
<dt> &lsquo;<samp>assume-new</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-W</samp>&rsquo; in <code>make</code>.
</p>
</dd>
<dt> &lsquo;<samp>assume-old</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-o</samp>&rsquo; in <code>make</code>.
</p>
</dd>
<dt> &lsquo;<samp>auto-check</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-a</samp>&rsquo; in <code>recode</code>.
</p>
</dd>
<dt> &lsquo;<samp>auto-pager</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-a</samp>&rsquo; in <code>wdiff</code>.
</p>
</dd>
<dt> &lsquo;<samp>auto-reference</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-A</samp>&rsquo; in <code>ptx</code>.
</p>
</dd>
<dt> &lsquo;<samp>avoid-wraps</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-n</samp>&rsquo; in <code>wdiff</code>.
</p>
</dd>
<dt> &lsquo;<samp>background</samp>&rsquo;</dt>
<dd><p>For server programs, run in the background.
</p>
</dd>
<dt> &lsquo;<samp>backward-search</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-B</samp>&rsquo; in <code>ctags</code>.
</p>
</dd>
<dt> &lsquo;<samp>basename</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-f</samp>&rsquo; in <code>shar</code>.
</p>
</dd>
<dt> &lsquo;<samp>batch</samp>&rsquo;</dt>
<dd><p>Used in GDB.
</p>
</dd>
<dt> &lsquo;<samp>baud</samp>&rsquo;</dt>
<dd><p>Used in GDB.
</p>
</dd>
<dt> &lsquo;<samp>before</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-b</samp>&rsquo; in <code>tac</code>.
</p>
</dd>
<dt> &lsquo;<samp>binary</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-b</samp>&rsquo; in <code>cpio</code> and <code>diff</code>.
</p>
</dd>
<dt> &lsquo;<samp>bits-per-code</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-b</samp>&rsquo; in <code>shar</code>.
</p>
</dd>
<dt> &lsquo;<samp>block-size</samp>&rsquo;</dt>
<dd><p>Used in <code>cpio</code> and <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>blocks</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-b</samp>&rsquo; in <code>head</code> and <code>tail</code>.
</p>
</dd>
<dt> &lsquo;<samp>break-file</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-b</samp>&rsquo; in <code>ptx</code>.
</p>
</dd>
<dt> &lsquo;<samp>brief</samp>&rsquo;</dt>
<dd><p>Used in various programs to make output shorter.
</p>
</dd>
<dt> &lsquo;<samp>bytes</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-c</samp>&rsquo; in <code>head</code>, <code>split</code>, and <code>tail</code>.
</p>
</dd>
<dt> &lsquo;<samp>c<tt>++</tt></samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-C</samp>&rsquo; in <code>etags</code>.
</p>
</dd>
<dt> &lsquo;<samp>catenate</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-A</samp>&rsquo; in <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>cd</samp>&rsquo;</dt>
<dd><p>Used in various programs to specify the directory to use.
</p>
</dd>
<dt> &lsquo;<samp>changes</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-c</samp>&rsquo; in <code>chgrp</code> and <code>chown</code>.
</p>
</dd>
<dt> &lsquo;<samp>classify</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-F</samp>&rsquo; in <code>ls</code>.
</p>
</dd>
<dt> &lsquo;<samp>colons</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-c</samp>&rsquo; in <code>recode</code>.
</p>
</dd>
<dt> &lsquo;<samp>command</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-c</samp>&rsquo; in <code>su</code>;
&lsquo;<samp>-x</samp>&rsquo; in GDB.
</p>
</dd>
<dt> &lsquo;<samp>compare</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-d</samp>&rsquo; in <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>compat</samp>&rsquo;</dt>
<dd><p>Used in <code>gawk</code>.
</p>
</dd>
<dt> &lsquo;<samp>compress</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-Z</samp>&rsquo; in <code>tar</code> and <code>shar</code>.
</p>
</dd>
<dt> &lsquo;<samp>concatenate</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-A</samp>&rsquo; in <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>confirmation</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-w</samp>&rsquo; in <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>context</samp>&rsquo;</dt>
<dd><p>Used in <code>diff</code>.
</p>
</dd>
<dt> &lsquo;<samp>copyleft</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-W copyleft</samp>&rsquo; in <code>gawk</code>.
</p>
</dd>
<dt> &lsquo;<samp>copyright</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-C</samp>&rsquo; in <code>ptx</code>, <code>recode</code>, and <code>wdiff</code>;
&lsquo;<samp>-W copyright</samp>&rsquo; in <code>gawk</code>.
</p>
</dd>
<dt> &lsquo;<samp>core</samp>&rsquo;</dt>
<dd><p>Used in GDB.
</p>
</dd>
<dt> &lsquo;<samp>count</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-q</samp>&rsquo; in <code>who</code>.
</p>
</dd>
<dt> &lsquo;<samp>count-links</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-l</samp>&rsquo; in <code>du</code>.
</p>
</dd>
<dt> &lsquo;<samp>create</samp>&rsquo;</dt>
<dd><p>Used in <code>tar</code> and <code>cpio</code>.
</p>
</dd>
<dt> &lsquo;<samp>cut-mark</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-c</samp>&rsquo; in <code>shar</code>.
</p>
</dd>
<dt> &lsquo;<samp>cxref</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-x</samp>&rsquo; in <code>ctags</code>.
</p>
</dd>
<dt> &lsquo;<samp>date</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-d</samp>&rsquo; in <code>touch</code>.
</p>
</dd>
<dt> &lsquo;<samp>debug</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-d</samp>&rsquo; in <code>make</code> and <code>m4</code>;
&lsquo;<samp>-t</samp>&rsquo; in Bison.
</p>
</dd>
<dt> &lsquo;<samp>define</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-D</samp>&rsquo; in <code>m4</code>.
</p>
</dd>
<dt> &lsquo;<samp>defines</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-d</samp>&rsquo; in Bison and <code>ctags</code>.
</p>
</dd>
<dt> &lsquo;<samp>delete</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-D</samp>&rsquo; in <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>dereference</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-L</samp>&rsquo; in <code>chgrp</code>, <code>chown</code>, <code>cpio</code>, <code>du</code>,
<code>ls</code>, and <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>dereference-args</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-D</samp>&rsquo; in <code>du</code>.
</p>
</dd>
<dt> &lsquo;<samp>device</samp>&rsquo;</dt>
<dd><p>Specify an I/O device (special file name).
</p>
</dd>
<dt> &lsquo;<samp>diacritics</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-d</samp>&rsquo; in <code>recode</code>.
</p>
</dd>
<dt> &lsquo;<samp>dictionary-order</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-d</samp>&rsquo; in <code>look</code>.
</p>
</dd>
<dt> &lsquo;<samp>diff</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-d</samp>&rsquo; in <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>digits</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-n</samp>&rsquo; in <code>csplit</code>.
</p>
</dd>
<dt> &lsquo;<samp>directory</samp>&rsquo;</dt>
<dd><p>Specify the directory to use, in various programs.  In <code>ls</code>, it
means to show directories themselves rather than their contents.  In
<code>rm</code> and <code>ln</code>, it means to not treat links to directories
specially.
</p>
</dd>
<dt> &lsquo;<samp>discard-all</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-x</samp>&rsquo; in <code>strip</code>.
</p>
</dd>
<dt> &lsquo;<samp>discard-locals</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-X</samp>&rsquo; in <code>strip</code>.
</p>
</dd>
<dt> &lsquo;<samp>dry-run</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-n</samp>&rsquo; in <code>make</code>.
</p>
</dd>
<dt> &lsquo;<samp>ed</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-e</samp>&rsquo; in <code>diff</code>.
</p>
</dd>
<dt> &lsquo;<samp>elide-empty-files</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-z</samp>&rsquo; in <code>csplit</code>.
</p>
</dd>
<dt> &lsquo;<samp>end-delete</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-x</samp>&rsquo; in <code>wdiff</code>.
</p>
</dd>
<dt> &lsquo;<samp>end-insert</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-z</samp>&rsquo; in <code>wdiff</code>.
</p>
</dd>
<dt> &lsquo;<samp>entire-new-file</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-N</samp>&rsquo; in <code>diff</code>.
</p>
</dd>
<dt> &lsquo;<samp>environment-overrides</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-e</samp>&rsquo; in <code>make</code>.
</p>
</dd>
<dt> &lsquo;<samp>eof</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-e</samp>&rsquo; in <code>xargs</code>.
</p>
</dd>
<dt> &lsquo;<samp>epoch</samp>&rsquo;</dt>
<dd><p>Used in GDB.
</p>
</dd>
<dt> &lsquo;<samp>error-limit</samp>&rsquo;</dt>
<dd><p>Used in <code>makeinfo</code>.
</p>
</dd>
<dt> &lsquo;<samp>error-output</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-o</samp>&rsquo; in <code>m4</code>.
</p>
</dd>
<dt> &lsquo;<samp>escape</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-b</samp>&rsquo; in <code>ls</code>.
</p>
</dd>
<dt> &lsquo;<samp>exclude-from</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-X</samp>&rsquo; in <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>exec</samp>&rsquo;</dt>
<dd><p>Used in GDB.
</p>
</dd>
<dt> &lsquo;<samp>exit</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-x</samp>&rsquo; in <code>xargs</code>.
</p>
</dd>
<dt> &lsquo;<samp>exit-0</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-e</samp>&rsquo; in <code>unshar</code>.
</p>
</dd>
<dt> &lsquo;<samp>expand-tabs</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-t</samp>&rsquo; in <code>diff</code>.
</p>
</dd>
<dt> &lsquo;<samp>expression</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-e</samp>&rsquo; in <code>sed</code>.
</p>
</dd>
<dt> &lsquo;<samp>extern-only</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-g</samp>&rsquo; in <code>nm</code>.
</p>
</dd>
<dt> &lsquo;<samp>extract</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-i</samp>&rsquo; in <code>cpio</code>;
&lsquo;<samp>-x</samp>&rsquo; in <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>faces</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-f</samp>&rsquo; in <code>finger</code>.
</p>
</dd>
<dt> &lsquo;<samp>fast</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-f</samp>&rsquo; in <code>su</code>.
</p>
</dd>
<dt> &lsquo;<samp>fatal-warnings</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-E</samp>&rsquo; in <code>m4</code>.
</p>
</dd>
<dt> &lsquo;<samp>file</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-f</samp>&rsquo; in <code>gawk</code>, <code>info</code>, <code>make</code>, <code>mt</code>,
<code>sed</code>, and <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>field-separator</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-F</samp>&rsquo; in <code>gawk</code>.
</p>
</dd>
<dt> &lsquo;<samp>file-prefix</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-b</samp>&rsquo; in Bison.
</p>
</dd>
<dt> &lsquo;<samp>file-type</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-F</samp>&rsquo; in <code>ls</code>.
</p>
</dd>
<dt> &lsquo;<samp>files-from</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-T</samp>&rsquo; in <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>fill-column</samp>&rsquo;</dt>
<dd><p>Used in <code>makeinfo</code>.
</p>
</dd>
<dt> &lsquo;<samp>flag-truncation</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-F</samp>&rsquo; in <code>ptx</code>.
</p>
</dd>
<dt> &lsquo;<samp>fixed-output-files</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-y</samp>&rsquo; in Bison.
</p>
</dd>
<dt> &lsquo;<samp>follow</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-f</samp>&rsquo; in <code>tail</code>.
</p>
</dd>
<dt> &lsquo;<samp>footnote-style</samp>&rsquo;</dt>
<dd><p>Used in <code>makeinfo</code>.
</p>
</dd>
<dt> &lsquo;<samp>force</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-f</samp>&rsquo; in <code>cp</code>, <code>ln</code>, <code>mv</code>, and <code>rm</code>.
</p>
</dd>
<dt> &lsquo;<samp>force-prefix</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-F</samp>&rsquo; in <code>shar</code>.
</p>
</dd>
<dt> &lsquo;<samp>foreground</samp>&rsquo;</dt>
<dd><p>For server programs, run in the foreground;
in other words, don&rsquo;t do anything special to run the server
in the background.
</p>
</dd>
<dt> &lsquo;<samp>format</samp>&rsquo;</dt>
<dd><p>Used in <code>ls</code>, <code>time</code>, and <code>ptx</code>.
</p>
</dd>
<dt> &lsquo;<samp>freeze-state</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-F</samp>&rsquo; in <code>m4</code>.
</p>
</dd>
<dt> &lsquo;<samp>fullname</samp>&rsquo;</dt>
<dd><p>Used in GDB.
</p>
</dd>
<dt> &lsquo;<samp>gap-size</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-g</samp>&rsquo; in <code>ptx</code>.
</p>
</dd>
<dt> &lsquo;<samp>get</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-x</samp>&rsquo; in <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>graphic</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-i</samp>&rsquo; in <code>ul</code>.
</p>
</dd>
<dt> &lsquo;<samp>graphics</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-g</samp>&rsquo; in <code>recode</code>.
</p>
</dd>
<dt> &lsquo;<samp>group</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-g</samp>&rsquo; in <code>install</code>.
</p>
</dd>
<dt> &lsquo;<samp>gzip</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-z</samp>&rsquo; in <code>tar</code> and <code>shar</code>.
</p>
</dd>
<dt> &lsquo;<samp>hashsize</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-H</samp>&rsquo; in <code>m4</code>.
</p>
</dd>
<dt> &lsquo;<samp>header</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-h</samp>&rsquo; in <code>objdump</code> and <code>recode</code>
</p>
</dd>
<dt> &lsquo;<samp>heading</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-H</samp>&rsquo; in <code>who</code>.
</p>
</dd>
<dt> &lsquo;<samp>help</samp>&rsquo;</dt>
<dd><p>Used to ask for brief usage information.
</p>
</dd>
<dt> &lsquo;<samp>here-delimiter</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-d</samp>&rsquo; in <code>shar</code>.
</p>
</dd>
<dt> &lsquo;<samp>hide-control-chars</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-q</samp>&rsquo; in <code>ls</code>.
</p>
</dd>
<dt> &lsquo;<samp>html</samp>&rsquo;</dt>
<dd><p>In <code>makeinfo</code>, output HTML.
</p>
</dd>
<dt> &lsquo;<samp>idle</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-u</samp>&rsquo; in <code>who</code>.
</p>
</dd>
<dt> &lsquo;<samp>ifdef</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-D</samp>&rsquo; in <code>diff</code>.
</p>
</dd>
<dt> &lsquo;<samp>ignore</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-I</samp>&rsquo; in <code>ls</code>;
&lsquo;<samp>-x</samp>&rsquo; in <code>recode</code>.
</p>
</dd>
<dt> &lsquo;<samp>ignore-all-space</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-w</samp>&rsquo; in <code>diff</code>.
</p>
</dd>
<dt> &lsquo;<samp>ignore-backups</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-B</samp>&rsquo; in <code>ls</code>.
</p>
</dd>
<dt> &lsquo;<samp>ignore-blank-lines</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-B</samp>&rsquo; in <code>diff</code>.
</p>
</dd>
<dt> &lsquo;<samp>ignore-case</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-f</samp>&rsquo; in <code>look</code> and <code>ptx</code>;
&lsquo;<samp>-i</samp>&rsquo; in <code>diff</code> and <code>wdiff</code>.
</p>
</dd>
<dt> &lsquo;<samp>ignore-errors</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-i</samp>&rsquo; in <code>make</code>.
</p>
</dd>
<dt> &lsquo;<samp>ignore-file</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-i</samp>&rsquo; in <code>ptx</code>.
</p>
</dd>
<dt> &lsquo;<samp>ignore-indentation</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-I</samp>&rsquo; in <code>etags</code>.
</p>
</dd>
<dt> &lsquo;<samp>ignore-init-file</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-f</samp>&rsquo; in Oleo.
</p>
</dd>
<dt> &lsquo;<samp>ignore-interrupts</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-i</samp>&rsquo; in <code>tee</code>.
</p>
</dd>
<dt> &lsquo;<samp>ignore-matching-lines</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-I</samp>&rsquo; in <code>diff</code>.
</p>
</dd>
<dt> &lsquo;<samp>ignore-space-change</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-b</samp>&rsquo; in <code>diff</code>.
</p>
</dd>
<dt> &lsquo;<samp>ignore-zeros</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-i</samp>&rsquo; in <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>include</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-i</samp>&rsquo; in <code>etags</code>;
&lsquo;<samp>-I</samp>&rsquo; in <code>m4</code>.
</p>
</dd>
<dt> &lsquo;<samp>include-dir</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-I</samp>&rsquo; in <code>make</code>.
</p>
</dd>
<dt> &lsquo;<samp>incremental</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-G</samp>&rsquo; in <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>info</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-i</samp>&rsquo;, &lsquo;<samp>-l</samp>&rsquo;, and &lsquo;<samp>-m</samp>&rsquo; in Finger.
</p>
</dd>
<dt> &lsquo;<samp>init-file</samp>&rsquo;</dt>
<dd><p>In some programs, specify the name of the file to read as the user&rsquo;s
init file.
</p>
</dd>
<dt> &lsquo;<samp>initial</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-i</samp>&rsquo; in <code>expand</code>.
</p>
</dd>
<dt> &lsquo;<samp>initial-tab</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-T</samp>&rsquo; in <code>diff</code>.
</p>
</dd>
<dt> &lsquo;<samp>inode</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-i</samp>&rsquo; in <code>ls</code>.
</p>
</dd>
<dt> &lsquo;<samp>interactive</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-i</samp>&rsquo; in <code>cp</code>, <code>ln</code>, <code>mv</code>, <code>rm</code>;
&lsquo;<samp>-e</samp>&rsquo; in <code>m4</code>;
&lsquo;<samp>-p</samp>&rsquo; in <code>xargs</code>;
&lsquo;<samp>-w</samp>&rsquo; in <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>intermix-type</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-p</samp>&rsquo; in <code>shar</code>.
</p>
</dd>
<dt> &lsquo;<samp>iso-8601</samp>&rsquo;</dt>
<dd><p>Used in <code>date</code>
</p>
</dd>
<dt> &lsquo;<samp>jobs</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-j</samp>&rsquo; in <code>make</code>.
</p>
</dd>
<dt> &lsquo;<samp>just-print</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-n</samp>&rsquo; in <code>make</code>.
</p>
</dd>
<dt> &lsquo;<samp>keep-going</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-k</samp>&rsquo; in <code>make</code>.
</p>
</dd>
<dt> &lsquo;<samp>keep-files</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-k</samp>&rsquo; in <code>csplit</code>.
</p>
</dd>
<dt> &lsquo;<samp>kilobytes</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-k</samp>&rsquo; in <code>du</code> and <code>ls</code>.
</p>
</dd>
<dt> &lsquo;<samp>language</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-l</samp>&rsquo; in <code>etags</code>.
</p>
</dd>
<dt> &lsquo;<samp>less-mode</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-l</samp>&rsquo; in <code>wdiff</code>.
</p>
</dd>
<dt> &lsquo;<samp>level-for-gzip</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-g</samp>&rsquo; in <code>shar</code>.
</p>
</dd>
<dt> &lsquo;<samp>line-bytes</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-C</samp>&rsquo; in <code>split</code>.
</p>
</dd>
<dt> &lsquo;<samp>lines</samp>&rsquo;</dt>
<dd><p>Used in <code>split</code>, <code>head</code>, and <code>tail</code>.
</p>
</dd>
<dt> &lsquo;<samp>link</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-l</samp>&rsquo; in <code>cpio</code>.
</p>
</dd>
<dt> &lsquo;<samp>lint</samp>&rsquo;</dt>
<dt> &lsquo;<samp>lint-old</samp>&rsquo;</dt>
<dd><p>Used in <code>gawk</code>.
</p>
</dd>
<dt> &lsquo;<samp>list</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-t</samp>&rsquo; in <code>cpio</code>;
&lsquo;<samp>-l</samp>&rsquo; in <code>recode</code>.
</p>
</dd>
<dt> &lsquo;<samp>list</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-t</samp>&rsquo; in <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>literal</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-N</samp>&rsquo; in <code>ls</code>.
</p>
</dd>
<dt> &lsquo;<samp>load-average</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-l</samp>&rsquo; in <code>make</code>.
</p>
</dd>
<dt> &lsquo;<samp>login</samp>&rsquo;</dt>
<dd><p>Used in <code>su</code>.
</p>
</dd>
<dt> &lsquo;<samp>machine</samp>&rsquo;</dt>
<dd><p>Used in <code>uname</code>.
</p>
</dd>
<dt> &lsquo;<samp>macro-name</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-M</samp>&rsquo; in <code>ptx</code>.
</p>
</dd>
<dt> &lsquo;<samp>mail</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-m</samp>&rsquo; in <code>hello</code> and <code>uname</code>.
</p>
</dd>
<dt> &lsquo;<samp>make-directories</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-d</samp>&rsquo; in <code>cpio</code>.
</p>
</dd>
<dt> &lsquo;<samp>makefile</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-f</samp>&rsquo; in <code>make</code>.
</p>
</dd>
<dt> &lsquo;<samp>mapped</samp>&rsquo;</dt>
<dd><p>Used in GDB.
</p>
</dd>
<dt> &lsquo;<samp>max-args</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-n</samp>&rsquo; in <code>xargs</code>.
</p>
</dd>
<dt> &lsquo;<samp>max-chars</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-n</samp>&rsquo; in <code>xargs</code>.
</p>
</dd>
<dt> &lsquo;<samp>max-lines</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-l</samp>&rsquo; in <code>xargs</code>.
</p>
</dd>
<dt> &lsquo;<samp>max-load</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-l</samp>&rsquo; in <code>make</code>.
</p>
</dd>
<dt> &lsquo;<samp>max-procs</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-P</samp>&rsquo; in <code>xargs</code>.
</p>
</dd>
<dt> &lsquo;<samp>mesg</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-T</samp>&rsquo; in <code>who</code>.
</p>
</dd>
<dt> &lsquo;<samp>message</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-T</samp>&rsquo; in <code>who</code>.
</p>
</dd>
<dt> &lsquo;<samp>minimal</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-d</samp>&rsquo; in <code>diff</code>.
</p>
</dd>
<dt> &lsquo;<samp>mixed-uuencode</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-M</samp>&rsquo; in <code>shar</code>.
</p>
</dd>
<dt> &lsquo;<samp>mode</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-m</samp>&rsquo; in <code>install</code>, <code>mkdir</code>, and <code>mkfifo</code>.
</p>
</dd>
<dt> &lsquo;<samp>modification-time</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-m</samp>&rsquo; in <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>multi-volume</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-M</samp>&rsquo; in <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>name-prefix</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-a</samp>&rsquo; in Bison.
</p>
</dd>
<dt> &lsquo;<samp>nesting-limit</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-L</samp>&rsquo; in <code>m4</code>.
</p>
</dd>
<dt> &lsquo;<samp>net-headers</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-a</samp>&rsquo; in <code>shar</code>.
</p>
</dd>
<dt> &lsquo;<samp>new-file</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-W</samp>&rsquo; in <code>make</code>.
</p>
</dd>
<dt> &lsquo;<samp>no-builtin-rules</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-r</samp>&rsquo; in <code>make</code>.
</p>
</dd>
<dt> &lsquo;<samp>no-character-count</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-w</samp>&rsquo; in <code>shar</code>.
</p>
</dd>
<dt> &lsquo;<samp>no-check-existing</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-x</samp>&rsquo; in <code>shar</code>.
</p>
</dd>
<dt> &lsquo;<samp>no-common</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-3</samp>&rsquo; in <code>wdiff</code>.
</p>
</dd>
<dt> &lsquo;<samp>no-create</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-c</samp>&rsquo; in <code>touch</code>.
</p>
</dd>
<dt> &lsquo;<samp>no-defines</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-D</samp>&rsquo; in <code>etags</code>.
</p>
</dd>
<dt> &lsquo;<samp>no-deleted</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-1</samp>&rsquo; in <code>wdiff</code>.
</p>
</dd>
<dt> &lsquo;<samp>no-dereference</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-d</samp>&rsquo; in <code>cp</code>.
</p>
</dd>
<dt> &lsquo;<samp>no-inserted</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-2</samp>&rsquo; in <code>wdiff</code>.
</p>
</dd>
<dt> &lsquo;<samp>no-keep-going</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-S</samp>&rsquo; in <code>make</code>.
</p>
</dd>
<dt> &lsquo;<samp>no-lines</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-l</samp>&rsquo; in Bison.
</p>
</dd>
<dt> &lsquo;<samp>no-piping</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-P</samp>&rsquo; in <code>shar</code>.
</p>
</dd>
<dt> &lsquo;<samp>no-prof</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-e</samp>&rsquo; in <code>gprof</code>.
</p>
</dd>
<dt> &lsquo;<samp>no-regex</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-R</samp>&rsquo; in <code>etags</code>.
</p>
</dd>
<dt> &lsquo;<samp>no-sort</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-p</samp>&rsquo; in <code>nm</code>.
</p>
</dd>
<dt> &lsquo;<samp>no-splash</samp>&rsquo;</dt>
<dd><p>Don&rsquo;t print a startup splash screen.
</p>
</dd>
<dt> &lsquo;<samp>no-split</samp>&rsquo;</dt>
<dd><p>Used in <code>makeinfo</code>.
</p>
</dd>
<dt> &lsquo;<samp>no-static</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-a</samp>&rsquo; in <code>gprof</code>.
</p>
</dd>
<dt> &lsquo;<samp>no-time</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-E</samp>&rsquo; in <code>gprof</code>.
</p>
</dd>
<dt> &lsquo;<samp>no-timestamp</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-m</samp>&rsquo; in <code>shar</code>.
</p>
</dd>
<dt> &lsquo;<samp>no-validate</samp>&rsquo;</dt>
<dd><p>Used in <code>makeinfo</code>.
</p>
</dd>
<dt> &lsquo;<samp>no-wait</samp>&rsquo;</dt>
<dd><p>Used in <code>emacsclient</code>.
</p>
</dd>
<dt> &lsquo;<samp>no-warn</samp>&rsquo;</dt>
<dd><p>Used in various programs to inhibit warnings.
</p>
</dd>
<dt> &lsquo;<samp>node</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-n</samp>&rsquo; in <code>info</code>.
</p>
</dd>
<dt> &lsquo;<samp>nodename</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-n</samp>&rsquo; in <code>uname</code>.
</p>
</dd>
<dt> &lsquo;<samp>nonmatching</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-f</samp>&rsquo; in <code>cpio</code>.
</p>
</dd>
<dt> &lsquo;<samp>nstuff</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-n</samp>&rsquo; in <code>objdump</code>.
</p>
</dd>
<dt> &lsquo;<samp>null</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-0</samp>&rsquo; in <code>xargs</code>.
</p>
</dd>
<dt> &lsquo;<samp>number</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-n</samp>&rsquo; in <code>cat</code>.
</p>
</dd>
<dt> &lsquo;<samp>number-nonblank</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-b</samp>&rsquo; in <code>cat</code>.
</p>
</dd>
<dt> &lsquo;<samp>numeric-sort</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-n</samp>&rsquo; in <code>nm</code>.
</p>
</dd>
<dt> &lsquo;<samp>numeric-uid-gid</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-n</samp>&rsquo; in <code>cpio</code> and <code>ls</code>.
</p>
</dd>
<dt> &lsquo;<samp>nx</samp>&rsquo;</dt>
<dd><p>Used in GDB.
</p>
</dd>
<dt> &lsquo;<samp>old-archive</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-o</samp>&rsquo; in <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>old-file</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-o</samp>&rsquo; in <code>make</code>.
</p>
</dd>
<dt> &lsquo;<samp>one-file-system</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-l</samp>&rsquo; in <code>tar</code>, <code>cp</code>, and <code>du</code>.
</p>
</dd>
<dt> &lsquo;<samp>only-file</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-o</samp>&rsquo; in <code>ptx</code>.
</p>
</dd>
<dt> &lsquo;<samp>only-prof</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-f</samp>&rsquo; in <code>gprof</code>.
</p>
</dd>
<dt> &lsquo;<samp>only-time</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-F</samp>&rsquo; in <code>gprof</code>.
</p>
</dd>
<dt> &lsquo;<samp>options</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-o</samp>&rsquo; in <code>getopt</code>, <code>fdlist</code>, <code>fdmount</code>,
<code>fdmountd</code>, and <code>fdumount</code>.
</p>
</dd>
<dt> &lsquo;<samp>output</samp>&rsquo;</dt>
<dd><p>In various programs, specify the output file name.
</p>
</dd>
<dt> &lsquo;<samp>output-prefix</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-o</samp>&rsquo; in <code>shar</code>.
</p>
</dd>
<dt> &lsquo;<samp>override</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-o</samp>&rsquo; in <code>rm</code>.
</p>
</dd>
<dt> &lsquo;<samp>overwrite</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-c</samp>&rsquo; in <code>unshar</code>.
</p>
</dd>
<dt> &lsquo;<samp>owner</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-o</samp>&rsquo; in <code>install</code>.
</p>
</dd>
<dt> &lsquo;<samp>paginate</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-l</samp>&rsquo; in <code>diff</code>.
</p>
</dd>
<dt> &lsquo;<samp>paragraph-indent</samp>&rsquo;</dt>
<dd><p>Used in <code>makeinfo</code>.
</p>
</dd>
<dt> &lsquo;<samp>parents</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-p</samp>&rsquo; in <code>mkdir</code> and <code>rmdir</code>.
</p>
</dd>
<dt> &lsquo;<samp>pass-all</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-p</samp>&rsquo; in <code>ul</code>.
</p>
</dd>
<dt> &lsquo;<samp>pass-through</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-p</samp>&rsquo; in <code>cpio</code>.
</p>
</dd>
<dt> &lsquo;<samp>port</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-P</samp>&rsquo; in <code>finger</code>.
</p>
</dd>
<dt> &lsquo;<samp>portability</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-c</samp>&rsquo; in <code>cpio</code> and <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>posix</samp>&rsquo;</dt>
<dd><p>Used in <code>gawk</code>.
</p>
</dd>
<dt> &lsquo;<samp>prefix-builtins</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-P</samp>&rsquo; in <code>m4</code>.
</p>
</dd>
<dt> &lsquo;<samp>prefix</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-f</samp>&rsquo; in <code>csplit</code>.
</p>
</dd>
<dt> &lsquo;<samp>preserve</samp>&rsquo;</dt>
<dd><p>Used in <code>tar</code> and <code>cp</code>.
</p>
</dd>
<dt> &lsquo;<samp>preserve-environment</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-p</samp>&rsquo; in <code>su</code>.
</p>
</dd>
<dt> &lsquo;<samp>preserve-modification-time</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-m</samp>&rsquo; in <code>cpio</code>.
</p>
</dd>
<dt> &lsquo;<samp>preserve-order</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-s</samp>&rsquo; in <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>preserve-permissions</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-p</samp>&rsquo; in <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>print</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-l</samp>&rsquo; in <code>diff</code>.
</p>
</dd>
<dt> &lsquo;<samp>print-chars</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-L</samp>&rsquo; in <code>cmp</code>.
</p>
</dd>
<dt> &lsquo;<samp>print-data-base</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-p</samp>&rsquo; in <code>make</code>.
</p>
</dd>
<dt> &lsquo;<samp>print-directory</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-w</samp>&rsquo; in <code>make</code>.
</p>
</dd>
<dt> &lsquo;<samp>print-file-name</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-o</samp>&rsquo; in <code>nm</code>.
</p>
</dd>
<dt> &lsquo;<samp>print-symdefs</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-s</samp>&rsquo; in <code>nm</code>.
</p>
</dd>
<dt> &lsquo;<samp>printer</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-p</samp>&rsquo; in <code>wdiff</code>.
</p>
</dd>
<dt> &lsquo;<samp>prompt</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-p</samp>&rsquo; in <code>ed</code>.
</p>
</dd>
<dt> &lsquo;<samp>proxy</samp>&rsquo;</dt>
<dd><p>Specify an HTTP proxy.
</p>
</dd>
<dt> &lsquo;<samp>query-user</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-X</samp>&rsquo; in <code>shar</code>.
</p>
</dd>
<dt> &lsquo;<samp>question</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-q</samp>&rsquo; in <code>make</code>.
</p>
</dd>
<dt> &lsquo;<samp>quiet</samp>&rsquo;</dt>
<dd><p>Used in many programs to inhibit the usual output.  Every
program accepting &lsquo;<samp>--quiet</samp>&rsquo; should accept &lsquo;<samp>--silent</samp>&rsquo; as a
synonym.
</p>
</dd>
<dt> &lsquo;<samp>quiet-unshar</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-Q</samp>&rsquo; in <code>shar</code>
</p>
</dd>
<dt> &lsquo;<samp>quote-name</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-Q</samp>&rsquo; in <code>ls</code>.
</p>
</dd>
<dt> &lsquo;<samp>rcs</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-n</samp>&rsquo; in <code>diff</code>.
</p>
</dd>
<dt> &lsquo;<samp>re-interval</samp>&rsquo;</dt>
<dd><p>Used in <code>gawk</code>.
</p>
</dd>
<dt> &lsquo;<samp>read-full-blocks</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-B</samp>&rsquo; in <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>readnow</samp>&rsquo;</dt>
<dd><p>Used in GDB.
</p>
</dd>
<dt> &lsquo;<samp>recon</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-n</samp>&rsquo; in <code>make</code>.
</p>
</dd>
<dt> &lsquo;<samp>record-number</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-R</samp>&rsquo; in <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>recursive</samp>&rsquo;</dt>
<dd><p>Used in <code>chgrp</code>, <code>chown</code>, <code>cp</code>, <code>ls</code>, <code>diff</code>,
and <code>rm</code>.
</p>
</dd>
<dt> &lsquo;<samp>reference</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-r</samp>&rsquo; in <code>touch</code>.
</p>
</dd>
<dt> &lsquo;<samp>references</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-r</samp>&rsquo; in <code>ptx</code>.
</p>
</dd>
<dt> &lsquo;<samp>regex</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-r</samp>&rsquo; in <code>tac</code> and <code>etags</code>.
</p>
</dd>
<dt> &lsquo;<samp>release</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-r</samp>&rsquo; in <code>uname</code>.
</p>
</dd>
<dt> &lsquo;<samp>reload-state</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-R</samp>&rsquo; in <code>m4</code>.
</p>
</dd>
<dt> &lsquo;<samp>relocation</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-r</samp>&rsquo; in <code>objdump</code>.
</p>
</dd>
<dt> &lsquo;<samp>rename</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-r</samp>&rsquo; in <code>cpio</code>.
</p>
</dd>
<dt> &lsquo;<samp>replace</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-i</samp>&rsquo; in <code>xargs</code>.
</p>
</dd>
<dt> &lsquo;<samp>report-identical-files</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-s</samp>&rsquo; in <code>diff</code>.
</p>
</dd>
<dt> &lsquo;<samp>reset-access-time</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-a</samp>&rsquo; in <code>cpio</code>.
</p>
</dd>
<dt> &lsquo;<samp>reverse</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-r</samp>&rsquo; in <code>ls</code> and <code>nm</code>.
</p>
</dd>
<dt> &lsquo;<samp>reversed-ed</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-f</samp>&rsquo; in <code>diff</code>.
</p>
</dd>
<dt> &lsquo;<samp>right-side-defs</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-R</samp>&rsquo; in <code>ptx</code>.
</p>
</dd>
<dt> &lsquo;<samp>same-order</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-s</samp>&rsquo; in <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>same-permissions</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-p</samp>&rsquo; in <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>save</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-g</samp>&rsquo; in <code>stty</code>.
</p>
</dd>
<dt> &lsquo;<samp>se</samp>&rsquo;</dt>
<dd><p>Used in GDB.
</p>
</dd>
<dt> &lsquo;<samp>sentence-regexp</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-S</samp>&rsquo; in <code>ptx</code>.
</p>
</dd>
<dt> &lsquo;<samp>separate-dirs</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-S</samp>&rsquo; in <code>du</code>.
</p>
</dd>
<dt> &lsquo;<samp>separator</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-s</samp>&rsquo; in <code>tac</code>.
</p>
</dd>
<dt> &lsquo;<samp>sequence</samp>&rsquo;</dt>
<dd><p>Used by <code>recode</code> to chose files or pipes for sequencing passes.
</p>
</dd>
<dt> &lsquo;<samp>shell</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-s</samp>&rsquo; in <code>su</code>.
</p>
</dd>
<dt> &lsquo;<samp>show-all</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-A</samp>&rsquo; in <code>cat</code>.
</p>
</dd>
<dt> &lsquo;<samp>show-c-function</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-p</samp>&rsquo; in <code>diff</code>.
</p>
</dd>
<dt> &lsquo;<samp>show-ends</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-E</samp>&rsquo; in <code>cat</code>.
</p>
</dd>
<dt> &lsquo;<samp>show-function-line</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-F</samp>&rsquo; in <code>diff</code>.
</p>
</dd>
<dt> &lsquo;<samp>show-tabs</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-T</samp>&rsquo; in <code>cat</code>.
</p>
</dd>
<dt> &lsquo;<samp>silent</samp>&rsquo;</dt>
<dd><p>Used in many programs to inhibit the usual output.
Every program accepting
&lsquo;<samp>--silent</samp>&rsquo; should accept &lsquo;<samp>--quiet</samp>&rsquo; as a synonym.
</p>
</dd>
<dt> &lsquo;<samp>size</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-s</samp>&rsquo; in <code>ls</code>.
</p>
</dd>
<dt> &lsquo;<samp>socket</samp>&rsquo;</dt>
<dd><p>Specify a file descriptor for a network server to use for its socket,
instead of opening and binding a new socket.  This provides a way to
run, in a non-privileged process, a server that normally needs a
reserved port number.
</p>
</dd>
<dt> &lsquo;<samp>sort</samp>&rsquo;</dt>
<dd><p>Used in <code>ls</code>.
</p>
</dd>
<dt> &lsquo;<samp>source</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-W source</samp>&rsquo; in <code>gawk</code>.
</p>
</dd>
<dt> &lsquo;<samp>sparse</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-S</samp>&rsquo; in <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>speed-large-files</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-H</samp>&rsquo; in <code>diff</code>.
</p>
</dd>
<dt> &lsquo;<samp>split-at</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-E</samp>&rsquo; in <code>unshar</code>.
</p>
</dd>
<dt> &lsquo;<samp>split-size-limit</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-L</samp>&rsquo; in <code>shar</code>.
</p>
</dd>
<dt> &lsquo;<samp>squeeze-blank</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-s</samp>&rsquo; in <code>cat</code>.
</p>
</dd>
<dt> &lsquo;<samp>start-delete</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-w</samp>&rsquo; in <code>wdiff</code>.
</p>
</dd>
<dt> &lsquo;<samp>start-insert</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-y</samp>&rsquo; in <code>wdiff</code>.
</p>
</dd>
<dt> &lsquo;<samp>starting-file</samp>&rsquo;</dt>
<dd><p>Used in <code>tar</code> and <code>diff</code> to specify which file within
a directory to start processing with.
</p>
</dd>
<dt> &lsquo;<samp>statistics</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-s</samp>&rsquo; in <code>wdiff</code>.
</p>
</dd>
<dt> &lsquo;<samp>stdin-file-list</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-S</samp>&rsquo; in <code>shar</code>.
</p>
</dd>
<dt> &lsquo;<samp>stop</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-S</samp>&rsquo; in <code>make</code>.
</p>
</dd>
<dt> &lsquo;<samp>strict</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-s</samp>&rsquo; in <code>recode</code>.
</p>
</dd>
<dt> &lsquo;<samp>strip</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-s</samp>&rsquo; in <code>install</code>.
</p>
</dd>
<dt> &lsquo;<samp>strip-all</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-s</samp>&rsquo; in <code>strip</code>.
</p>
</dd>
<dt> &lsquo;<samp>strip-debug</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-S</samp>&rsquo; in <code>strip</code>.
</p>
</dd>
<dt> &lsquo;<samp>submitter</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-s</samp>&rsquo; in <code>shar</code>.
</p>
</dd>
<dt> &lsquo;<samp>suffix</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-S</samp>&rsquo; in <code>cp</code>, <code>ln</code>, <code>mv</code>.
</p>
</dd>
<dt> &lsquo;<samp>suffix-format</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-b</samp>&rsquo; in <code>csplit</code>.
</p>
</dd>
<dt> &lsquo;<samp>sum</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-s</samp>&rsquo; in <code>gprof</code>.
</p>
</dd>
<dt> &lsquo;<samp>summarize</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-s</samp>&rsquo; in <code>du</code>.
</p>
</dd>
<dt> &lsquo;<samp>symbolic</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-s</samp>&rsquo; in <code>ln</code>.
</p>
</dd>
<dt> &lsquo;<samp>symbols</samp>&rsquo;</dt>
<dd><p>Used in GDB and <code>objdump</code>.
</p>
</dd>
<dt> &lsquo;<samp>synclines</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-s</samp>&rsquo; in <code>m4</code>.
</p>
</dd>
<dt> &lsquo;<samp>sysname</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-s</samp>&rsquo; in <code>uname</code>.
</p>
</dd>
<dt> &lsquo;<samp>tabs</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-t</samp>&rsquo; in <code>expand</code> and <code>unexpand</code>.
</p>
</dd>
<dt> &lsquo;<samp>tabsize</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-T</samp>&rsquo; in <code>ls</code>.
</p>
</dd>
<dt> &lsquo;<samp>terminal</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-T</samp>&rsquo; in <code>tput</code> and <code>ul</code>.
&lsquo;<samp>-t</samp>&rsquo; in <code>wdiff</code>.
</p>
</dd>
<dt> &lsquo;<samp>text</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-a</samp>&rsquo; in <code>diff</code>.
</p>
</dd>
<dt> &lsquo;<samp>text-files</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-T</samp>&rsquo; in <code>shar</code>.
</p>
</dd>
<dt> &lsquo;<samp>time</samp>&rsquo;</dt>
<dd><p>Used in <code>ls</code> and <code>touch</code>.
</p>
</dd>
<dt> &lsquo;<samp>timeout</samp>&rsquo;</dt>
<dd><p>Specify how long to wait before giving up on some operation.
</p>
</dd>
<dt> &lsquo;<samp>to-stdout</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-O</samp>&rsquo; in <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>total</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-c</samp>&rsquo; in <code>du</code>.
</p>
</dd>
<dt> &lsquo;<samp>touch</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-t</samp>&rsquo; in <code>make</code>, <code>ranlib</code>, and <code>recode</code>.
</p>
</dd>
<dt> &lsquo;<samp>trace</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-t</samp>&rsquo; in <code>m4</code>.
</p>
</dd>
<dt> &lsquo;<samp>traditional</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-t</samp>&rsquo; in <code>hello</code>;
&lsquo;<samp>-W traditional</samp>&rsquo; in <code>gawk</code>;
&lsquo;<samp>-G</samp>&rsquo; in <code>ed</code>, <code>m4</code>, and <code>ptx</code>.
</p>
</dd>
<dt> &lsquo;<samp>tty</samp>&rsquo;</dt>
<dd><p>Used in GDB.
</p>
</dd>
<dt> &lsquo;<samp>typedefs</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-t</samp>&rsquo; in <code>ctags</code>.
</p>
</dd>
<dt> &lsquo;<samp>typedefs-and-c++</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-T</samp>&rsquo; in <code>ctags</code>.
</p>
</dd>
<dt> &lsquo;<samp>typeset-mode</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-t</samp>&rsquo; in <code>ptx</code>.
</p>
</dd>
<dt> &lsquo;<samp>uncompress</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-z</samp>&rsquo; in <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>unconditional</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-u</samp>&rsquo; in <code>cpio</code>.
</p>
</dd>
<dt> &lsquo;<samp>undefine</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-U</samp>&rsquo; in <code>m4</code>.
</p>
</dd>
<dt> &lsquo;<samp>undefined-only</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-u</samp>&rsquo; in <code>nm</code>.
</p>
</dd>
<dt> &lsquo;<samp>update</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-u</samp>&rsquo; in <code>cp</code>, <code>ctags</code>, <code>mv</code>, <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>usage</samp>&rsquo;</dt>
<dd><p>Used in <code>gawk</code>; same as &lsquo;<samp>--help</samp>&rsquo;.
</p>
</dd>
<dt> &lsquo;<samp>uuencode</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-B</samp>&rsquo; in <code>shar</code>.
</p>
</dd>
<dt> &lsquo;<samp>vanilla-operation</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-V</samp>&rsquo; in <code>shar</code>.
</p>
</dd>
<dt> &lsquo;<samp>verbose</samp>&rsquo;</dt>
<dd><p>Print more information about progress.  Many programs support this.
</p>
</dd>
<dt> &lsquo;<samp>verify</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-W</samp>&rsquo; in <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>version</samp>&rsquo;</dt>
<dd><p>Print the version number.
</p>
</dd>
<dt> &lsquo;<samp>version-control</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-V</samp>&rsquo; in <code>cp</code>, <code>ln</code>, <code>mv</code>.
</p>
</dd>
<dt> &lsquo;<samp>vgrind</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-v</samp>&rsquo; in <code>ctags</code>.
</p>
</dd>
<dt> &lsquo;<samp>volume</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-V</samp>&rsquo; in <code>tar</code>.
</p>
</dd>
<dt> &lsquo;<samp>what-if</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-W</samp>&rsquo; in <code>make</code>.
</p>
</dd>
<dt> &lsquo;<samp>whole-size-limit</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-l</samp>&rsquo; in <code>shar</code>.
</p>
</dd>
<dt> &lsquo;<samp>width</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-w</samp>&rsquo; in <code>ls</code> and <code>ptx</code>.
</p>
</dd>
<dt> &lsquo;<samp>word-regexp</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-W</samp>&rsquo; in <code>ptx</code>.
</p>
</dd>
<dt> &lsquo;<samp>writable</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-T</samp>&rsquo; in <code>who</code>.
</p>
</dd>
<dt> &lsquo;<samp>zeros</samp>&rsquo;</dt>
<dd><p>&lsquo;<samp>-z</samp>&rsquo; in <code>gprof</code>.
</p></dd>
</dl>

<hr size="6">
<a name="OID-Allocations"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Option-Table" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Memory-Usage" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="OID-Allocations-1"></a>
<h2 class="section">4.10 OID Allocations</h2>
<a name="index-OID-allocations-for-GNU"></a>
<a name="index-SNMP"></a>
<a name="index-LDAP"></a>
<a name="index-X_002e509"></a>

<p>The OID (object identifier) 1.3.6.1.4.1.11591 has been assigned to the
GNU Project (thanks to Werner Koch).  These are used for SNMP, LDAP,
X.509 certificates, and so on.  The web site
<a href="http://www.alvestrand.no/objectid">http://www.alvestrand.no/objectid</a> has a (voluntary) listing of
many OID assignments.
</p>
<p>If you need a new slot for your GNU package, write
<a href="mailto:maintainers@gnu.org">maintainers@gnu.org</a>.  Here is a list of arcs currently
assigned:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">
1.3.6.1.4.1.11591 GNU

1.3.6.1.4.1.11591.1 GNU Radius

1.3.6.1.4.1.11591.2 GnuPG 
  1.3.6.1.4.1.11591.2.1   notation
  1.3.6.1.4.1.11591.2.1.1 pkaAddress

1.3.6.1.4.1.11591.3 GNU Radar

1.3.6.1.4.1.11591.4 GNU GSS

1.3.6.1.4.1.11591.5 GNU Mailutils

1.3.6.1.4.1.11591.6 GNU Shishi

1.3.6.1.4.1.11591.7 GNU Radio

1.3.6.1.4.1.11591.8 GNU Dico

1.3.6.1.4.1.11591.12 digestAlgorithm
  1.3.6.1.4.1.11591.12.2 TIGER/192
  1.3.6.1.4.1.11591.13 encryptionAlgorithm
    1.3.6.1.4.1.11591.13.2 Serpent
      1.3.6.1.4.1.11591.13.2.1 Serpent-128-ECB
      1.3.6.1.4.1.11591.13.2.2 Serpent-128-CBC
      1.3.6.1.4.1.11591.13.2.3 Serpent-128-OFB
      1.3.6.1.4.1.11591.13.2.4 Serpent-128-CFB
      1.3.6.1.4.1.11591.13.2.21 Serpent-192-ECB
      1.3.6.1.4.1.11591.13.2.22 Serpent-192-CBC
      1.3.6.1.4.1.11591.13.2.23 Serpent-192-OFB
      1.3.6.1.4.1.11591.13.2.24 Serpent-192-CFB
      1.3.6.1.4.1.11591.13.2.41 Serpent-256-ECB
      1.3.6.1.4.1.11591.13.2.42 Serpent-256-CBC
      1.3.6.1.4.1.11591.13.2.43 Serpent-256-OFB
      1.3.6.1.4.1.11591.13.2.44 Serpent-256-CFB
  1.3.6.1.4.1.11591.14 CRC algorithms
    1.3.6.1.4.1.11591.14.1 CRC 32
</pre></td></tr></table>


<hr size="6">
<a name="Memory-Usage"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#OID-Allocations" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#File-Usage" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Memory-Usage-1"></a>
<h2 class="section">4.11 Memory Usage</h2>
<a name="index-memory-usage"></a>

<p>If a program typically uses just a few meg of memory, don&rsquo;t bother making any
effort to reduce memory usage.  For example, if it is impractical for
other reasons to operate on files more than a few meg long, it is
reasonable to read entire input files into memory to operate on them.
</p>
<p>However, for programs such as <code>cat</code> or <code>tail</code>, that can
usefully operate on very large files, it is important to avoid using a
technique that would artificially limit the size of files it can handle.
If a program works by lines and could be applied to arbitrary
user-supplied input files, it should keep only a line in memory, because
this is not very hard and users will want to be able to operate on input
files that are bigger than will fit in memory all at once.
</p>
<p>If your program creates complicated data structures, just make them in
memory and give a fatal error if <code>malloc</code> returns zero.
</p>
<a name="index-valgrind"></a>
<a name="index-memory-leak"></a>
<p>Memory analysis tools such as <code>valgrind</code> can be useful, but
don&rsquo;t complicate a program merely to avoid their false alarms.  For
example, if memory is used until just before a process exits, don&rsquo;t
free it simply to silence such a tool.
</p>

<hr size="6">
<a name="File-Usage"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Memory-Usage" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="File-Usage-1"></a>
<h2 class="section">4.12 File Usage</h2>
<a name="index-file-usage"></a>

<p>Programs should be prepared to operate when &lsquo;<tt>/usr</tt>&rsquo; and &lsquo;<tt>/etc</tt>&rsquo;
are read-only file systems.  Thus, if the program manages log files,
lock files, backup files, score files, or any other files which are
modified for internal purposes, these files should not be stored in
&lsquo;<tt>/usr</tt>&rsquo; or &lsquo;<tt>/etc</tt>&rsquo;.
</p>
<p>There are two exceptions.  &lsquo;<tt>/etc</tt>&rsquo; is used to store system
configuration information; it is reasonable for a program to modify
files in &lsquo;<tt>/etc</tt>&rsquo; when its job is to update the system configuration.
Also, if the user explicitly asks to modify one file in a directory, it
is reasonable for the program to store other files in the same
directory.
</p>
<hr size="6">
<a name="Writing-C"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#File-Usage" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Formatting" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Program-Behavior" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Documentation" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Making-The-Best-Use-of-C"></a>
<h1 class="chapter">5. Making The Best Use of C</h1>

<p>This chapter provides advice on how best to use the C language
when writing GNU software.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Formatting">5.1 Formatting Your Source Code</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                  Formatting your source code.
</td></tr>
<tr><td align="left" valign="top"><a href="#Comments">5.2 Commenting Your Work</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                    Commenting your work.
</td></tr>
<tr><td align="left" valign="top"><a href="#Syntactic-Conventions">5.3 Clean Use of C Constructs</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">       Clean use of C constructs.
</td></tr>
<tr><td align="left" valign="top"><a href="#Names">5.4 Naming Variables, Functions, and Files</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                       Naming variables, functions, and files.
</td></tr>
<tr><td align="left" valign="top"><a href="#System-Portability">5.5 Portability between System Types</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">          Portability among different operating systems.
</td></tr>
<tr><td align="left" valign="top"><a href="#CPU-Portability">5.6 Portability between <small>CPU</small>s</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">             Supporting the range of CPU types.
</td></tr>
<tr><td align="left" valign="top"><a href="#System-Functions">5.7 Calling System Functions</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">            Portability and &ldquo;standard&rdquo; library functions.
</td></tr>
<tr><td align="left" valign="top"><a href="#Internationalization">5.8 Internationalization</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">        Techniques for internationalization.
</td></tr>
<tr><td align="left" valign="top"><a href="#Character-Set">5.9 Character Set</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">               Use ASCII by default.
</td></tr>
<tr><td align="left" valign="top"><a href="#Quote-Characters">5.10 Quote Characters</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">            Use &lsquo;...&rsquo; in the C locale.
</td></tr>
<tr><td align="left" valign="top"><a href="#Mmap">5.11 Mmap</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                        How you can safely use <code>mmap</code>.
</td></tr>
</table>

<hr size="6">
<a name="Formatting"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Writing-C" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Comments" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Documentation" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Formatting-Your-Source-Code"></a>
<h2 class="section">5.1 Formatting Your Source Code</h2>
<a name="index-formatting-source-code"></a>

<a name="index-open-brace"></a>
<a name="index-braces_002c-in-C-source"></a>
<p>It is important to put the open-brace that starts the body of a C
function in column one, so that they will start a defun.  Several
tools look for open-braces in column one to find the beginnings of C
functions.  These tools will not work on code not formatted that way.
</p>
<p>Avoid putting open-brace, open-parenthesis or open-bracket in column
one when they are inside a function, so that they won&rsquo;t start a defun.
The open-brace that starts a <code>struct</code> body can go in column one
if you find it useful to treat that definition as a defun.
</p>
<p>It is also important for function definitions to start the name of the
function in column one.  This helps people to search for function
definitions, and may also help certain tools recognize them.  Thus,
using Standard C syntax, the format is this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">static char *
concat (char *s1, char *s2)
{
  &hellip;
}
</pre></td></tr></table>

<p>or, if you want to use traditional C syntax, format the definition like
this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">static char *
concat (s1, s2)        /* Name starts in column one here */
     char *s1, *s2;
{                     /* Open brace in column one here */
  &hellip;
}
</pre></td></tr></table>

<p>In Standard C, if the arguments don&rsquo;t fit nicely on one line,
split it like this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">int
lots_of_args (int an_integer, long a_long, short a_short,
              double a_double, float a_float)
&hellip;
</pre></td></tr></table>

<p>The rest of this section gives our recommendations for other aspects of
C formatting style, which is also the default style of the <code>indent</code>
program in version 1.2 and newer.  It corresponds to the options
</p>
<table><tr><td>&nbsp;</td><td><pre class="smallexample">-nbad -bap -nbc -bbo -bl -bli2 -bls -ncdb -nce -cp1 -cs -di2
-ndj -nfc1 -nfca -hnl -i2 -ip5 -lp -pcs -psl -nsc -nsob
</pre></td></tr></table>

<p>We don&rsquo;t think of these recommendations as requirements, because it
causes no problems for users if two different programs have different
formatting styles.
</p>
<p>But whatever style you use, please use it consistently, since a mixture
of styles within one program tends to look ugly.  If you are
contributing changes to an existing program, please follow the style of
that program.
</p>
<p>For the body of the function, our recommended style looks like this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">if (x &lt; foo (y, z))
  haha = bar[4] + 5;
else
  {
    while (z)
      {
        haha += foo (z, z);
        z--;
      }
    return ++x + bar ();
  }
</pre></td></tr></table>

<a name="index-spaces-before-open_002dparen"></a>
<p>We find it easier to read a program when it has spaces before the
open-parentheses and after the commas.  Especially after the commas.
</p>
<p>When you split an expression into multiple lines, split it
before an operator, not after one.  Here is the right way:
</p>
<a name="index-expressions_002c-splitting"></a>
<table><tr><td>&nbsp;</td><td><pre class="example">if (foo_this_is_long &amp;&amp; bar &gt; win (x, y, z)
    &amp;&amp; remaining_condition)
</pre></td></tr></table>

<p>Try to avoid having two operators of different precedence at the same
level of indentation.  For example, don&rsquo;t write this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">mode = (inmode[j] == VOIDmode
        || GET_MODE_SIZE (outmode[j]) &gt; GET_MODE_SIZE (inmode[j])
        ? outmode[j] : inmode[j]);
</pre></td></tr></table>

<p>Instead, use extra parentheses so that the indentation shows the nesting:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">mode = ((inmode[j] == VOIDmode
         || (GET_MODE_SIZE (outmode[j]) &gt; GET_MODE_SIZE (inmode[j])))
        ? outmode[j] : inmode[j]);
</pre></td></tr></table>

<p>Insert extra parentheses so that Emacs will indent the code properly.
For example, the following indentation looks nice if you do it by hand,
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">v = rup-&gt;ru_utime.tv_sec*1000 + rup-&gt;ru_utime.tv_usec/1000
    + rup-&gt;ru_stime.tv_sec*1000 + rup-&gt;ru_stime.tv_usec/1000;
</pre></td></tr></table>

<p>but Emacs would alter it.  Adding a set of parentheses produces
something that looks equally nice, and which Emacs will preserve:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">v = (rup-&gt;ru_utime.tv_sec*1000 + rup-&gt;ru_utime.tv_usec/1000
     + rup-&gt;ru_stime.tv_sec*1000 + rup-&gt;ru_stime.tv_usec/1000);
</pre></td></tr></table>

<p>Format do-while statements like this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">do
  {
    a = foo (a);
  }
while (a &gt; 0);
</pre></td></tr></table>

<a name="index-formfeed"></a>
<a name="index-control_002dL"></a>
<p>Please use formfeed characters (control-L) to divide the program into
pages at logical places (but not within a function).  It does not matter
just how long the pages are, since they do not have to fit on a printed
page.  The formfeeds should appear alone on lines by themselves.
</p>
<hr size="6">
<a name="Comments"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Formatting" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Syntactic-Conventions" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Documentation" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Commenting-Your-Work"></a>
<h2 class="section">5.2 Commenting Your Work</h2>
<a name="index-commenting"></a>

<p>Every program should start with a comment saying briefly what it is for.
Example: &lsquo;<samp>fmt - filter for simple filling of text</samp>&rsquo;.  This comment
should be at the top of the source file containing the &lsquo;<samp>main</samp>&rsquo;
function of the program.
</p>
<p>Also, please write a brief comment at the start of each source file,
with the file name and a line or two about the overall purpose of the
file.
</p>
<p>Please write the comments in a GNU program in English, because English
is the one language that nearly all programmers in all countries can
read.  If you do not write English well, please write comments in
English as well as you can, then ask other people to help rewrite them.
If you can&rsquo;t write comments in English, please find someone to work with
you and translate your comments into English.
</p>
<p>Please put a comment on each function saying what the function does,
what sorts of arguments it gets, and what the possible values of
arguments mean and are used for.  It is not necessary to duplicate in
words the meaning of the C argument declarations, if a C type is being
used in its customary fashion.  If there is anything nonstandard about
its use (such as an argument of type <code>char *</code> which is really the
address of the second character of a string, not the first), or any
possible values that would not work the way one would expect (such as,
that strings containing newlines are not guaranteed to work), be sure
to say so.
</p>
<p>Also explain the significance of the return value, if there is one.
</p>
<p>Please put two spaces after the end of a sentence in your comments, so
that the Emacs sentence commands will work.  Also, please write
complete sentences and capitalize the first word.  If a lower-case
identifier comes at the beginning of a sentence, don&rsquo;t capitalize it!
Changing the spelling makes it a different identifier.  If you don&rsquo;t
like starting a sentence with a lower case letter, write the sentence
differently (e.g., &ldquo;The identifier lower-case is &hellip;&rdquo;).
</p>
<p>The comment on a function is much clearer if you use the argument
names to speak about the argument values.  The variable name itself
should be lower case, but write it in upper case when you are speaking
about the value rather than the variable itself.  Thus, &ldquo;the inode
number NODE_NUM&rdquo; rather than &ldquo;an inode&rdquo;.
</p>
<p>There is usually no purpose in restating the name of the function in
the comment before it, because the reader can see that for himself.
There might be an exception when the comment is so long that the function
itself would be off the bottom of the screen.
</p>
<p>There should be a comment on each static variable as well, like this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">/* Nonzero means truncate lines in the display;
   zero means continue them.  */
int truncate_lines;
</pre></td></tr></table>

<a name="index-conditionals_002c-comments-for"></a>
<a name="index-_0023endif_002c-commenting"></a>
<p>Every &lsquo;<samp>#endif</samp>&rsquo; should have a comment, except in the case of short
conditionals (just a few lines) that are not nested.  The comment should
state the condition of the conditional that is ending, <em>including
its sense</em>.  &lsquo;<samp>#else</samp>&rsquo; should have a comment describing the condition
<em>and sense</em> of the code that follows.  For example:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">#ifdef foo
  &hellip;
#else /* not foo */
  &hellip;
#endif /* not foo */
</pre><pre class="example">#ifdef foo
  &hellip;
#endif /* foo */
</pre></td></tr></table>

<p>but, by contrast, write the comments this way for a &lsquo;<samp>#ifndef</samp>&rsquo;:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">#ifndef foo
  &hellip;
#else /* foo */
  &hellip;
#endif /* foo */
</pre><pre class="example">#ifndef foo
  &hellip;
#endif /* not foo */
</pre></td></tr></table>

<hr size="6">
<a name="Syntactic-Conventions"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Comments" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Names" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Documentation" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Clean-Use-of-C-Constructs"></a>
<h2 class="section">5.3 Clean Use of C Constructs</h2>
<a name="index-syntactic-conventions"></a>

<a name="index-implicit-int"></a>
<a name="index-function-argument_002c-declaring"></a>
<p>Please explicitly declare the types of all objects.  For example, you
should explicitly declare all arguments to functions, and you should
declare functions to return <code>int</code> rather than omitting the
<code>int</code>.
</p>
<a name="index-compiler-warnings"></a>
<a name="index-_002dWall-compiler-option"></a>
<p>Some programmers like to use the GCC &lsquo;<samp>-Wall</samp>&rsquo; option, and change the
code whenever it issues a warning.  If you want to do this, then do.
Other programmers prefer not to use &lsquo;<samp>-Wall</samp>&rsquo;, because it gives
warnings for valid and legitimate code which they do not want to change.
If you want to do this, then do.  The compiler should be your servant,
not your master.
</p>
<a name="index-clang"></a>
<a name="index-lint"></a>
<p>Don&rsquo;t make the program ugly just to placate static analysis tools such
as <code>lint</code>, <code>clang</code>, and GCC with extra warnings
options such as &lsquo;<samp>-Wconversion</samp>&rsquo; and &lsquo;<samp>-Wundef</samp>&rsquo;.  These
tools can help find bugs and unclear code, but they can also generate
so many false alarms that that it hurts readability to silence them
with unnecessary casts, wrappers, and other complications.  For
example, please don&rsquo;t insert casts to <code>void</code> or calls to
do-nothing functions merely to pacify a lint checker.
</p>
<p>Declarations of external functions and functions to appear later in the
source file should all go in one place near the beginning of the file
(somewhere before the first function definition in the file), or else
should go in a header file.  Don&rsquo;t put <code>extern</code> declarations inside
functions.
</p>
<a name="index-temporary-variables"></a>
<p>It used to be common practice to use the same local variables (with
names like <code>tem</code>) over and over for different values within one
function.  Instead of doing this, it is better to declare a separate local
variable for each distinct purpose, and give it a name which is
meaningful.  This not only makes programs easier to understand, it also
facilitates optimization by good compilers.  You can also move the
declaration of each local variable into the smallest scope that includes
all its uses.  This makes the program even cleaner.
</p>
<p>Don&rsquo;t use local variables or parameters that shadow global identifiers.
GCC&rsquo;s &lsquo;<samp>-Wshadow</samp>&rsquo; option can detect this problem.
</p>
<a name="index-multiple-variables-in-a-line"></a>
<p>Don&rsquo;t declare multiple variables in one declaration that spans lines.
Start a new declaration on each line, instead.  For example, instead
of this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">int    foo,
       bar;
</pre></td></tr></table>

<p>write either this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">int foo, bar;
</pre></td></tr></table>

<p>or this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">int foo;
int bar;
</pre></td></tr></table>

<p>(If they are global variables, each should have a comment preceding it
anyway.)
</p>
<p>When you have an <code>if</code>-<code>else</code> statement nested in another
<code>if</code> statement, always put braces around the <code>if</code>-<code>else</code>.
Thus, never write like this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">if (foo)
  if (bar)
    win ();
  else
    lose ();
</pre></td></tr></table>

<p>always like this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">if (foo)
  {
    if (bar)
      win ();
    else
      lose ();
  }
</pre></td></tr></table>

<p>If you have an <code>if</code> statement nested inside of an <code>else</code>
statement, either write <code>else if</code> on one line, like this,
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">if (foo)
  &hellip;
else if (bar)
  &hellip;
</pre></td></tr></table>

<p>with its <code>then</code>-part indented like the preceding <code>then</code>-part,
or write the nested <code>if</code> within braces like this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">if (foo)
  &hellip;
else
  {
    if (bar)
      &hellip;
  }
</pre></td></tr></table>

<p>Don&rsquo;t declare both a structure tag and variables or typedefs in the
same declaration.  Instead, declare the structure tag separately
and then use it to declare the variables or typedefs.
</p>
<p>Try to avoid assignments inside <code>if</code>-conditions (assignments
inside <code>while</code>-conditions are ok).  For example, don&rsquo;t write
this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">if ((foo = (char *) malloc (sizeof *foo)) == 0)
  fatal (&quot;virtual memory exhausted&quot;);
</pre></td></tr></table>

<p>instead, write this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">foo = (char *) malloc (sizeof *foo);
if (foo == 0)
  fatal (&quot;virtual memory exhausted&quot;);
</pre></td></tr></table>

<p>This example uses zero without a cast as a null pointer constant.
This is perfectly fine, except that a cast is needed when calling a
varargs function or when using <code>sizeof</code>.
</p>
<hr size="6">
<a name="Names"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Syntactic-Conventions" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#System-Portability" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Documentation" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Naming-Variables_002c-Functions_002c-and-Files"></a>
<h2 class="section">5.4 Naming Variables, Functions, and Files</h2>

<a name="index-names-of-variables_002c-functions_002c-and-files"></a>
<p>The names of global variables and functions in a program serve as
comments of a sort.  So don&rsquo;t choose terse names&mdash;instead, look for
names that give useful information about the meaning of the variable or
function.  In a GNU program, names should be English, like other
comments.
</p>
<p>Local variable names can be shorter, because they are used only within
one context, where (presumably) comments explain their purpose.
</p>
<p>Try to limit your use of abbreviations in symbol names.  It is ok to
make a few abbreviations, explain what they mean, and then use them
frequently, but don&rsquo;t use lots of obscure abbreviations.
</p>
<p>Please use underscores to separate words in a name, so that the Emacs
word commands can be useful within them.  Stick to lower case; reserve
upper case for macros and <code>enum</code> constants, and for name-prefixes
that follow a uniform convention.
</p>
<p>For example, you should use names like <code>ignore_space_change_flag</code>;
don&rsquo;t use names like <code>iCantReadThis</code>.
</p>
<p>Variables that indicate whether command-line options have been
specified should be named after the meaning of the option, not after
the option-letter.  A comment should state both the exact meaning of
the option and its letter.  For example,
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">/* Ignore changes in horizontal whitespace (-b).  */
int ignore_space_change_flag;
</pre></td></tr></table>

<p>When you want to define names with constant integer values, use
<code>enum</code> rather than &lsquo;<samp>#define</samp>&rsquo;.  GDB knows about enumeration
constants.
</p>
<a name="index-file_002dname-limitations"></a>
<a name="index-doschk"></a>
<p>You might want to make sure that none of the file names would conflict
if the files were loaded onto an MS-DOS file system which shortens the
names.  You can use the program <code>doschk</code> to test for this.
</p>
<p>Some GNU programs were designed to limit themselves to file names of 14
characters or less, to avoid file name conflicts if they are read into
older System V systems.  Please preserve this feature in the existing
GNU programs that have it, but there is no need to do this in new GNU
programs.  <code>doschk</code> also reports file names longer than 14
characters.
</p>

<hr size="6">
<a name="System-Portability"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Names" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#CPU-Portability" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Documentation" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Portability-between-System-Types"></a>
<h2 class="section">5.5 Portability between System Types</h2>
<a name="index-portability_002c-between-system-types"></a>

<p>In the Unix world, &ldquo;portability&rdquo; refers to porting to different Unix
versions.  For a GNU program, this kind of portability is desirable, but
not paramount.
</p>
<p>The primary purpose of GNU software is to run on top of the GNU kernel,
compiled with the GNU C compiler, on various types of <small>CPU</small>.  So the
kinds of portability that are absolutely necessary are quite limited.
But it is important to support Linux-based GNU systems, since they
are the form of GNU that is popular.
</p>
<p>Beyond that, it is good to support the other free operating systems
(*BSD), and it is nice to support other Unix-like systems if you want
to.  Supporting a variety of Unix-like systems is desirable, although
not paramount.  It is usually not too hard, so you may as well do it.
But you don&rsquo;t have to consider it an obligation, if it does turn out to
be hard.
</p>
<a name="index-autoconf"></a>
<p>The easiest way to achieve portability to most Unix-like systems is to
use Autoconf.  It&rsquo;s unlikely that your program needs to know more
information about the host platform than Autoconf can provide, simply
because most of the programs that need such knowledge have already been
written.
</p>
<p>Avoid using the format of semi-internal data bases (e.g., directories)
when there is a higher-level alternative (<code>readdir</code>).
</p>
<a name="index-non_002dPOSIX-systems_002c-and-portability"></a>
<p>As for systems that are not like Unix, such as MSDOS, Windows, VMS, MVS,
and older Macintosh systems, supporting them is often a lot of work.
When that is the case, it is better to spend your time adding features
that will be useful on GNU and GNU/Linux, rather than on supporting
other incompatible systems.
</p>
<p>If you do support Windows, please do not abbreviate it as &ldquo;win&rdquo;.  In
hacker terminology, calling something a &ldquo;win&rdquo; is a form of praise.
You&rsquo;re free to praise Microsoft Windows on your own if you want, but
please don&rsquo;t do this in GNU packages.  Instead of abbreviating
&ldquo;Windows&rdquo; to &ldquo;win&rdquo;, you can write it in full or abbreviate it to
&ldquo;woe&rdquo; or &ldquo;w&rdquo;.  In GNU Emacs, for instance, we use &lsquo;<samp>w32</samp>&rsquo; in
file names of Windows-specific files, but the macro for Windows
conditionals is called <code>WINDOWSNT</code>.
</p>
<p>It is a good idea to define the &ldquo;feature test macro&rdquo;
<code>_GNU_SOURCE</code> when compiling your C files.  When you compile on GNU
or GNU/Linux, this will enable the declarations of GNU library extension
functions, and that will usually give you a compiler error message if
you define the same function names in some other way in your program.
(You don&rsquo;t have to actually <em>use</em> these functions, if you prefer
to make the program more portable to other systems.)
</p>
<p>But whether or not you use these GNU extensions, you should avoid
using their names for any other meanings.  Doing so would make it hard
to move your code into other GNU programs.
</p>
<hr size="6">
<a name="CPU-Portability"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#System-Portability" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#System-Functions" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Documentation" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Portability-between-CPUs"></a>
<h2 class="section">5.6 Portability between <small>CPU</small>s</h2>

<a name="index-data-types_002c-and-portability"></a>
<a name="index-portability_002c-and-data-types"></a>
<p>Even GNU systems will differ because of differences among <small>CPU</small>
types&mdash;for example, difference in byte ordering and alignment
requirements.  It is absolutely essential to handle these differences.
However, don&rsquo;t make any effort to cater to the possibility that an
<code>int</code> will be less than 32 bits.  We don&rsquo;t support 16-bit machines
in GNU.
</p>
<p>Similarly, don&rsquo;t make any effort to cater to the possibility that
<code>long</code> will be smaller than predefined types like <code>size_t</code>.
For example, the following code is ok:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">printf (&quot;size = %lu\n&quot;, (unsigned long) sizeof array);
printf (&quot;diff = %ld\n&quot;, (long) (pointer2 - pointer1));
</pre></td></tr></table>

<p>1989 Standard C requires this to work, and we know of only one
counterexample: 64-bit programs on Microsoft Windows.  We will leave
it to those who want to port GNU programs to that environment to
figure out how to do it.
</p>
<p>Predefined file-size types like <code>off_t</code> are an exception: they are
longer than <code>long</code> on many platforms, so code like the above won&rsquo;t
work with them.  One way to print an <code>off_t</code> value portably is to
print its digits yourself, one by one.
</p>
<p>Don&rsquo;t assume that the address of an <code>int</code> object is also the
address of its least-significant byte.  This is false on big-endian
machines.  Thus, don&rsquo;t make the following mistake:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">int c;
&hellip;
while ((c = getchar ()) != EOF)
  write (file_descriptor, &amp;c, 1);
</pre></td></tr></table>

<p>Instead, use <code>unsigned char</code> as follows.  (The <code>unsigned</code>
is for portability to unusual systems where <code>char</code> is signed and
where there is integer overflow checking.)
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">int c;
while ((c = getchar ()) != EOF)
  {
    unsigned char u = c;
    write (file_descriptor, &amp;u, 1);
  }
</pre></td></tr></table>

<a name="index-casting-pointers-to-integers"></a>
<p>Avoid casting pointers to integers if you can.  Such casts greatly
reduce portability, and in most programs they are easy to avoid.  In the
cases where casting pointers to integers is essential&mdash;such as, a Lisp
interpreter which stores type information as well as an address in one
word&mdash;you&rsquo;ll have to make explicit provisions to handle different word
sizes.  You will also need to make provision for systems in which the
normal range of addresses you can get from <code>malloc</code> starts far away
from zero.
</p>

<hr size="6">
<a name="System-Functions"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#CPU-Portability" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Internationalization" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Documentation" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Calling-System-Functions"></a>
<h2 class="section">5.7 Calling System Functions</h2>

<a name="index-C-library-functions_002c-and-portability"></a>
<a name="index-POSIX-functions_002c-and-portability"></a>
<a name="index-library-functions_002c-and-portability"></a>
<a name="index-portability_002c-and-library-functions"></a>

<p>Historically, C implementations differed substantially, and many
systems lacked a full implementation of ANSI/ISO C89.  Nowadays,
however, very few systems lack a C89 compiler and GNU C supports
almost all of C99.  Similarly, most systems implement POSIX.1-1993
libraries and tools, and many have POSIX.1-2001.
</p>
<p>Hence, there is little reason to support old C or non-POSIX systems,
and you may want to take advantage of C99 and POSIX-1.2001 to write
clearer, more portable, or faster code.  You should use standard
interfaces where possible; but if GNU extensions make your program
more maintainable, powerful, or otherwise better, don&rsquo;t hesitate to
use them.  In any case, don&rsquo;t make your own declaration of system
functions; that&rsquo;s a recipe for conflict.
</p>
<p>Despite the standards, nearly every library function has some sort of
portability issue on some system or another.  Here are some examples:
</p>
<dl compact="compact">
<dt> <code>open</code></dt>
<dd><p>Names with trailing <code>/</code>&rsquo;s are mishandled on many platforms.
</p>
</dd>
<dt> <code>printf</code></dt>
<dd><p><code>long double</code> may be unimplemented; floating values Infinity and
NaN are often mishandled; output for large precisions may be
incorrect.
</p>
</dd>
<dt> <code>readlink</code></dt>
<dd><p>May return <code>int</code> instead of <code>ssize_t</code>.
</p>
</dd>
<dt> <code>scanf</code></dt>
<dd><p>On Windows, <code>errno</code> is not set on failure.
</p></dd>
</dl>

<a name="index-Gnulib"></a>
<p><a href="http://www.gnu.org/software/gnulib/">Gnulib</a> is a big help in
this regard.  Gnulib provides implementations of standard interfaces
on many of the systems that lack them, including portable
implementations of enhanced GNU interfaces, thereby making their use
portable, and of POSIX-1.2008 interfaces, some of which are missing
even on up-to-date GNU systems.
</p>
<a name="index-xmalloc_002c-in-Gnulib"></a>
<a name="index-error-messages_002c-in-Gnulib"></a>
<a name="index-data-structures_002c-in-Gnulib"></a>
<p>Gnulib also provides many useful non-standard interfaces; for example,
C implementations of standard data structures (hash tables, binary
trees), error-checking type-safe wrappers for memory allocation
functions (<code>xmalloc</code>, <code>xrealloc</code>), and output of error
messages.
</p>
<p>Gnulib integrates with GNU Autoconf and Automake to remove much of the
burden of writing portable code from the programmer: Gnulib makes your
configure script automatically determine what features are missing and
use the Gnulib code to supply the missing pieces.
</p>
<p>The Gnulib and Autoconf manuals have extensive sections on
portability: <a href="gnulib.html#Top">(gnulib)Top</a> section &lsquo;Introduction&rsquo; in <cite>Gnulib</cite> and
see <a href="autoconf.html#Portable-C-and-C_002b_002b">(autoconf)Portable C and C++</a> section &lsquo;Portable C and C++&rsquo; in <cite>Autoconf</cite>.  Please consult them
for many more details.
</p>

<hr size="6">
<a name="Internationalization"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#System-Functions" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Character-Set" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Documentation" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Internationalization-1"></a>
<h2 class="section">5.8 Internationalization</h2>
<a name="index-internationalization"></a>

<a name="index-gettext"></a>
<p>GNU has a library called GNU gettext that makes it easy to translate the
messages in a program into various languages.  You should use this
library in every program.  Use English for the messages as they appear
in the program, and let gettext provide the way to translate them into
other languages.
</p>
<p>Using GNU gettext involves putting a call to the <code>gettext</code> macro
around each string that might need translation&mdash;like this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">printf (gettext (&quot;Processing file `%s'...&quot;));
</pre></td></tr></table>

<p>This permits GNU gettext to replace the string <code>&quot;Processing file
`%s'...&quot;</code> with a translated version.
</p>
<p>Once a program uses gettext, please make a point of writing calls to
<code>gettext</code> when you add new strings that call for translation.
</p>
<p>Using GNU gettext in a package involves specifying a <em>text domain
name</em> for the package.  The text domain name is used to separate the
translations for this package from the translations for other packages.
Normally, the text domain name should be the same as the name of the
package&mdash;for example, &lsquo;<samp>coreutils</samp>&rsquo; for the GNU core utilities.
</p>
<a name="index-message-text_002c-and-internationalization"></a>
<p>To enable gettext to work well, avoid writing code that makes
assumptions about the structure of words or sentences.  When you want
the precise text of a sentence to vary depending on the data, use two or
more alternative string constants each containing a complete sentences,
rather than inserting conditionalized words or phrases into a single
sentence framework.
</p>
<p>Here is an example of what not to do:
</p>
<table><tr><td>&nbsp;</td><td><pre class="smallexample">printf (&quot;%s is full&quot;, capacity &gt; 5000000 ? &quot;disk&quot; : &quot;floppy disk&quot;);
</pre></td></tr></table>

<p>If you apply gettext to all strings, like this,
</p>
<table><tr><td>&nbsp;</td><td><pre class="smallexample">printf (gettext (&quot;%s is full&quot;),
        capacity &gt; 5000000 ? gettext (&quot;disk&quot;) : gettext (&quot;floppy disk&quot;));
</pre></td></tr></table>

<p>the translator will hardly know that &quot;disk&quot; and &quot;floppy disk&quot; are meant to
be substituted in the other string.  Worse, in some languages (like French)
the construction will not work: the translation of the word &quot;full&quot; depends
on the gender of the first part of the sentence; it happens to be not the
same for &quot;disk&quot; as for &quot;floppy disk&quot;.
</p>
<p>Complete sentences can be translated without problems:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">printf (capacity &gt; 5000000 ? gettext (&quot;disk is full&quot;)
        : gettext (&quot;floppy disk is full&quot;));
</pre></td></tr></table>

<p>A similar problem appears at the level of sentence structure with this
code:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">printf (&quot;#  Implicit rule search has%s been done.\n&quot;,
        f-&gt;tried_implicit ? &quot;&quot; : &quot; not&quot;);
</pre></td></tr></table>

<p>Adding <code>gettext</code> calls to this code cannot give correct results for
all languages, because negation in some languages requires adding words
at more than one place in the sentence.  By contrast, adding
<code>gettext</code> calls does the job straightforwardly if the code starts
out like this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">printf (f-&gt;tried_implicit
        ? &quot;#  Implicit rule search has been done.\n&quot;,
        : &quot;#  Implicit rule search has not been done.\n&quot;);
</pre></td></tr></table>

<p>Another example is this one:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">printf (&quot;%d file%s processed&quot;, nfiles,
        nfiles != 1 ? &quot;s&quot; : &quot;&quot;);
</pre></td></tr></table>

<p>The problem with this example is that it assumes that plurals are made
by adding &lsquo;s&rsquo;.  If you apply gettext to the format string, like this,
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">printf (gettext (&quot;%d file%s processed&quot;), nfiles,
        nfiles != 1 ? &quot;s&quot; : &quot;&quot;);
</pre></td></tr></table>

<p>the message can use different words, but it will still be forced to use
&lsquo;s&rsquo; for the plural.  Here is a better way, with gettext being applied to
the two strings independently:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">printf ((nfiles != 1 ? gettext (&quot;%d files processed&quot;)
         : gettext (&quot;%d file processed&quot;)),
        nfiles);
</pre></td></tr></table>

<p>But this still doesn&rsquo;t work for languages like Polish, which has three
plural forms: one for nfiles == 1, one for nfiles == 2, 3, 4, 22, 23, 24, ...
and one for the rest.  The GNU <code>ngettext</code> function solves this problem:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">printf (ngettext (&quot;%d files processed&quot;, &quot;%d file processed&quot;, nfiles),
        nfiles);
</pre></td></tr></table>


<hr size="6">
<a name="Character-Set"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Internationalization" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Quote-Characters" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Documentation" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Character-Set-1"></a>
<h2 class="section">5.9 Character Set</h2>
<a name="index-character-set"></a>
<a name="index-encodings"></a>
<a name="index-ASCII-characters"></a>
<a name="index-non_002dASCII-characters"></a>

<p>Sticking to the ASCII character set (plain text, 7-bit characters) is
preferred in GNU source code comments, text documents, and other
contexts, unless there is good reason to do something else because of
the application domain.  For example, if source code deals with the
French Revolutionary calendar, it is OK if its literal strings contain
accented characters in month names like &ldquo;Flor&eacute;al&rdquo;.  Also, it is OK
to use non-ASCII characters to represent proper names of contributors in
change logs (see section <a href="#Change-Logs">Change Logs</a>).
</p>
<p>If you need to use non-ASCII characters, you should normally stick with
one encoding, as one cannot in general mix encodings reliably.
</p>

<hr size="6">
<a name="Quote-Characters"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Character-Set" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Mmap" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Documentation" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Quote-Characters-1"></a>
<h2 class="section">5.10 Quote Characters</h2>
<a name="index-quote-characters"></a>
<a name="index-locale_002dspecific-quote-characters"></a>
<a name="index-left-quote"></a>
<a name="index-grave-accent"></a>

<p>In the C locale, GNU programs should stick to plain ASCII for quotation
characters in messages to users: preferably 0x60 (&lsquo;<samp>`</samp>&rsquo;) for left
quotes and 0x27 (&lsquo;<samp>'</samp>&rsquo;) for right quotes.  It is ok, but not
required, to use locale-specific quotes in other locales.
</p>
<p>The <a href="http://www.gnu.org/software/gnulib/">Gnulib</a> <code>quote</code> and
<code>quotearg</code> modules provide a reasonably straightforward way to
support locale-specific quote characters, as well as taking care of
other issues, such as quoting a filename that itself contains a quote
character.  See the Gnulib documentation for usage details.
</p>
<p>In any case, the documentation for your program should clearly specify
how it does quoting, if different than the preferred method of &lsquo;<samp>`</samp>&rsquo;
and &lsquo;<samp>'</samp>&rsquo;.  This is especially important if the output of your
program is ever likely to be parsed by another program.
</p>
<p>Quotation characters are a difficult area in the computing world at
this time: there are no true left or right quote characters in Latin1;
the &lsquo;<samp>`</samp>&rsquo; character we use was standardized there as a grave
accent.  Moreover, Latin1 is still not universally usable.
</p>
<p>Unicode contains the unambiguous quote characters required, and its
common encoding UTF-8 is upward compatible with Latin1.  However,
Unicode and UTF-8 are not universally well-supported, either.
</p>
<p>This may change over the next few years, and then we will revisit
this.
</p>

<hr size="6">
<a name="Mmap"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Quote-Characters" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Documentation" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Documentation" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Mmap-1"></a>
<h2 class="section">5.11 Mmap</h2>
<a name="index-mmap"></a>

<p>Don&rsquo;t assume that <code>mmap</code> either works on all files or fails
for all files.  It may work on some files and fail on others.
</p>
<p>The proper way to use <code>mmap</code> is to try it on the specific file for
which you want to use it&mdash;and if <code>mmap</code> doesn&rsquo;t work, fall back on
doing the job in another way using <code>read</code> and <code>write</code>.
</p>
<p>The reason this precaution is needed is that the GNU kernel (the HURD)
provides a user-extensible file system, in which there can be many
different kinds of &ldquo;ordinary files.&rdquo;  Many of them support
<code>mmap</code>, but some do not.  It is important to make programs handle
all these kinds of files.
</p>
<hr size="6">
<a name="Documentation"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Mmap" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#GNU-Manuals" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Writing-C" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Managing-Releases" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Documenting-Programs"></a>
<h1 class="chapter">6. Documenting Programs</h1>
<a name="index-documentation"></a>

<p>A GNU program should ideally come with full free documentation, adequate
for both reference and tutorial purposes.  If the package can be
programmed or extended, the documentation should cover programming or
extending it, as well as just using it.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#GNU-Manuals">6.1 GNU Manuals</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                 Writing proper manuals.
</td></tr>
<tr><td align="left" valign="top"><a href="#Doc-Strings-and-Manuals">6.2 Doc Strings and Manuals</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">     Compiling doc strings doesn&rsquo;t make a manual.
</td></tr>
<tr><td align="left" valign="top"><a href="#Manual-Structure-Details">6.3 Manual Structure Details</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">    Specific structure conventions.
</td></tr>
<tr><td align="left" valign="top"><a href="#License-for-Manuals">6.4 License for Manuals</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">         Writing the distribution terms for a manual.
</td></tr>
<tr><td align="left" valign="top"><a href="#Manual-Credits">6.5 Manual Credits</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">              Giving credit to documentation contributors.
</td></tr>
<tr><td align="left" valign="top"><a href="#Printed-Manuals">6.6 Printed Manuals</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">             Mentioning the printed manual.
</td></tr>
<tr><td align="left" valign="top"><a href="#NEWS-File">6.7 The NEWS File</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                   NEWS files supplement manuals.
</td></tr>
<tr><td align="left" valign="top"><a href="#Change-Logs">6.8 Change Logs</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                 Recording changes.
</td></tr>
<tr><td align="left" valign="top"><a href="#Man-Pages">6.9 Man Pages</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                   Man pages are secondary.
</td></tr>
<tr><td align="left" valign="top"><a href="#Reading-other-Manuals">6.10 Reading other Manuals</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">       How far you can go in learning
                                from other manuals.
</td></tr>
</table>

<hr size="6">
<a name="GNU-Manuals"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Documentation" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Doc-Strings-and-Manuals" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Documentation" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Documentation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Managing-Releases" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="GNU-Manuals-1"></a>
<h2 class="section">6.1 GNU Manuals</h2>

<p>The preferred document format for the GNU system is the Texinfo
formatting language.  Every GNU package should (ideally) have
documentation in Texinfo both for reference and for learners.  Texinfo
makes it possible to produce a good quality formatted book, using
TeX, and to generate an Info file.  It is also possible to generate
HTML output from Texinfo source.  See the Texinfo manual, either the
hardcopy, or the on-line version available through <code>info</code> or the
Emacs Info subsystem (<kbd>C-h i</kbd>).
</p>
<p>Nowadays some other formats such as Docbook and Sgmltexi can be
converted automatically into Texinfo.  It is ok to produce the Texinfo
documentation by conversion this way, as long as it gives good results.
</p>
<p>Make sure your manual is clear to a reader who knows nothing about the
topic and reads it straight through.  This means covering basic topics
at the beginning, and advanced topics only later.  This also means
defining every specialized term when it is first used.
</p>
<p>Programmers tend to carry over the structure of the program as the
structure for its documentation.  But this structure is not
necessarily good for explaining how to use the program; it may be
irrelevant and confusing for a user.
</p>
<p>Instead, the right way to structure documentation is according to the
concepts and questions that a user will have in mind when reading it.
This principle applies at every level, from the lowest (ordering
sentences in a paragraph) to the highest (ordering of chapter topics
within the manual).  Sometimes this structure of ideas matches the
structure of the implementation of the software being documented&mdash;but
often they are different.  An important part of learning to write good
documentation is to learn to notice when you have unthinkingly
structured the documentation like the implementation, stop yourself,
and look for better alternatives.
</p>
<p>For example, each program in the GNU system probably ought to be
documented in one manual; but this does not mean each program should
have its own manual.  That would be following the structure of the
implementation, rather than the structure that helps the user
understand.
</p>
<p>Instead, each manual should cover a coherent <em>topic</em>.  For example,
instead of a manual for <code>diff</code> and a manual for <code>diff3</code>, we
have one manual for &ldquo;comparison of files&rdquo; which covers both of those
programs, as well as <code>cmp</code>.  By documenting these programs
together, we can make the whole subject clearer.
</p>
<p>The manual which discusses a program should certainly document all of
the program&rsquo;s command-line options and all of its commands.  It should
give examples of their use.  But don&rsquo;t organize the manual as a list
of features.  Instead, organize it logically, by subtopics.  Address
the questions that a user will ask when thinking about the job that
the program does.  Don&rsquo;t just tell the reader what each feature can
do&mdash;say what jobs it is good for, and show how to use it for those
jobs.  Explain what is recommended usage, and what kinds of usage
users should avoid.
</p>
<p>In general, a GNU manual should serve both as tutorial and reference.
It should be set up for convenient access to each topic through Info,
and for reading straight through (appendixes aside).  A GNU manual
should give a good introduction to a beginner reading through from the
start, and should also provide all the details that hackers want.
The Bison manual is a good example of this&mdash;please take a look at it
to see what we mean.
</p>
<p>That is not as hard as it first sounds.  Arrange each chapter as a
logical breakdown of its topic, but order the sections, and write their
text, so that reading the chapter straight through makes sense.  Do
likewise when structuring the book into chapters, and when structuring a
section into paragraphs.  The watchword is, <em>at each point, address
the most fundamental and important issue raised by the preceding text.</em>
</p>
<p>If necessary, add extra chapters at the beginning of the manual which
are purely tutorial and cover the basics of the subject.  These provide
the framework for a beginner to understand the rest of the manual.  The
Bison manual provides a good example of how to do this.
</p>
<p>To serve as a reference, a manual should have an Index that list all the
functions, variables, options, and important concepts that are part of
the program.  One combined Index should do for a short manual, but
sometimes for a complex package it is better to use multiple indices.
The Texinfo manual includes advice on preparing good index entries, see
<a href="texinfo.html#Index-Entries">(texinfo)Index Entries</a> section &lsquo;Making Index Entries&rsquo; in <cite>GNU Texinfo</cite>, and
see <a href="texinfo.html#Indexing-Commands">(texinfo)Indexing Commands</a> section &lsquo;Defining the Entries of an Index&rsquo; in <cite>GNU Texinfo</cite>.
</p>
<p>Don&rsquo;t use Unix man pages as a model for how to write GNU documentation;
most of them are terse, badly structured, and give inadequate
explanation of the underlying concepts.  (There are, of course, some
exceptions.)  Also, Unix man pages use a particular format which is
different from what we use in GNU manuals.
</p>
<p>Please include an email address in the manual for where to report
bugs <em>in the text of the manual</em>.
</p>
<p>Please do not use the term &ldquo;pathname&rdquo; that is used in Unix
documentation; use &ldquo;file name&rdquo; (two words) instead.  We use the term
&ldquo;path&rdquo; only for search paths, which are lists of directory names.
</p>
<p>Please do not use the term &ldquo;illegal&rdquo; to refer to erroneous input to
a computer program.  Please use &ldquo;invalid&rdquo; for this, and reserve the
term &ldquo;illegal&rdquo; for activities prohibited by law.
</p>
<p>Please do not write &lsquo;<samp>()</samp>&rsquo; after a function name just to indicate
it is a function.  <code>foo ()</code> is not a function, it is a function
call with no arguments.
</p>
<hr size="6">
<a name="Doc-Strings-and-Manuals"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#GNU-Manuals" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Manual-Structure-Details" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Documentation" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Documentation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Managing-Releases" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Doc-Strings-and-Manuals-1"></a>
<h2 class="section">6.2 Doc Strings and Manuals</h2>

<p>Some programming systems, such as Emacs, provide a documentation string
for each function, command or variable.  You may be tempted to write a
reference manual by compiling the documentation strings and writing a
little additional text to go around them&mdash;but you must not do it.  That
approach is a fundamental mistake.  The text of well-written
documentation strings will be entirely wrong for a manual.
</p>
<p>A documentation string needs to stand alone&mdash;when it appears on the
screen, there will be no other text to introduce or explain it.
Meanwhile, it can be rather informal in style.
</p>
<p>The text describing a function or variable in a manual must not stand
alone; it appears in the context of a section or subsection.  Other text
at the beginning of the section should explain some of the concepts, and
should often make some general points that apply to several functions or
variables.  The previous descriptions of functions and variables in the
section will also have given information about the topic.  A description
written to stand alone would repeat some of that information; this
redundancy looks bad.  Meanwhile, the informality that is acceptable in
a documentation string is totally unacceptable in a manual.
</p>
<p>The only good way to use documentation strings in writing a good manual
is to use them as a source of information for writing good text.
</p>
<hr size="6">
<a name="Manual-Structure-Details"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Doc-Strings-and-Manuals" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#License-for-Manuals" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Documentation" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Documentation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Managing-Releases" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Manual-Structure-Details-1"></a>
<h2 class="section">6.3 Manual Structure Details</h2>
<a name="index-manual-structure"></a>

<p>The title page of the manual should state the version of the programs or
packages documented in the manual.  The Top node of the manual should
also contain this information.  If the manual is changing more
frequently than or independent of the program, also state a version
number for the manual in both of these places.
</p>
<p>Each program documented in the manual should have a node named
&lsquo;<samp><var>program</var> Invocation</samp>&rsquo; or &lsquo;<samp>Invoking <var>program</var></samp>&rsquo;.  This
node (together with its subnodes, if any) should describe the program&rsquo;s
command line arguments and how to run it (the sort of information people
would look for in a man page).  Start with an &lsquo;<samp>@example</samp>&rsquo;
containing a template for all the options and arguments that the program
uses.
</p>
<p>Alternatively, put a menu item in some menu whose item name fits one of
the above patterns.  This identifies the node which that item points to
as the node for this purpose, regardless of the node&rsquo;s actual name.
</p>
<p>The &lsquo;<samp>--usage</samp>&rsquo; feature of the Info reader looks for such a node
or menu item in order to find the relevant text, so it is essential
for every Texinfo file to have one.
</p>
<p>If one manual describes several programs, it should have such a node for
each program described in the manual.
</p>
<hr size="6">
<a name="License-for-Manuals"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Manual-Structure-Details" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Manual-Credits" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Documentation" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Documentation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Managing-Releases" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="License-for-Manuals-1"></a>
<h2 class="section">6.4 License for Manuals</h2>
<a name="index-license-for-manuals"></a>

<p>Please use the GNU Free Documentation License for all GNU manuals that
are more than a few pages long.  Likewise for a collection of short
documents&mdash;you only need one copy of the GNU FDL for the whole
collection.  For a single short document, you can use a very permissive
non-copyleft license, to avoid taking up space with a long license.
</p>
<p>See <a href="http://www.gnu.org/copyleft/fdl-howto.html">http://www.gnu.org/copyleft/fdl-howto.html</a> for more explanation
of how to employ the GFDL.
</p>
<p>Note that it is not obligatory to include a copy of the GNU GPL or GNU
LGPL in a manual whose license is neither the GPL nor the LGPL.  It can
be a good idea to include the program&rsquo;s license in a large manual; in a
short manual, whose size would be increased considerably by including
the program&rsquo;s license, it is probably better not to include it.
</p>
<hr size="6">
<a name="Manual-Credits"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#License-for-Manuals" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Printed-Manuals" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Documentation" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Documentation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Managing-Releases" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Manual-Credits-1"></a>
<h2 class="section">6.5 Manual Credits</h2>
<a name="index-credits-for-manuals"></a>

<p>Please credit the principal human writers of the manual as the authors,
on the title page of the manual.  If a company sponsored the work, thank
the company in a suitable place in the manual, but do not cite the
company as an author.
</p>
<hr size="6">
<a name="Printed-Manuals"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Manual-Credits" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#NEWS-File" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Documentation" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Documentation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Managing-Releases" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Printed-Manuals-1"></a>
<h2 class="section">6.6 Printed Manuals</h2>

<p>The FSF publishes some GNU manuals in printed form.  To encourage sales
of these manuals, the on-line versions of the manual should mention at
the very start that the printed manual is available and should point at
information for getting it&mdash;for instance, with a link to the page
<a href="http://www.gnu.org/order/order.html">http://www.gnu.org/order/order.html</a>.  This should not be included
in the printed manual, though, because there it is redundant.
</p>
<p>It is also useful to explain in the on-line forms of the manual how the
user can print out the manual from the sources.
</p>
<hr size="6">
<a name="NEWS-File"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Printed-Manuals" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Change-Logs" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Documentation" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Documentation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Managing-Releases" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="The-NEWS-File"></a>
<h2 class="section">6.7 The NEWS File</h2>
<a name="index-NEWS-file"></a>

<p>In addition to its manual, the package should have a file named
&lsquo;<tt>NEWS</tt>&rsquo; which contains a list of user-visible changes worth
mentioning.  In each new release, add items to the front of the file and
identify the version they pertain to.  Don&rsquo;t discard old items; leave
them in the file after the newer items.  This way, a user upgrading from
any previous version can see what is new.
</p>
<p>If the &lsquo;<tt>NEWS</tt>&rsquo; file gets very long, move some of the older items
into a file named &lsquo;<tt>ONEWS</tt>&rsquo; and put a note at the end referring the
user to that file.
</p>
<hr size="6">
<a name="Change-Logs"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#NEWS-File" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Change-Log-Concepts" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Documentation" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Documentation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Managing-Releases" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Change-Logs-1"></a>
<h2 class="section">6.8 Change Logs</h2>
<a name="index-change-logs"></a>

<p>Keep a change log to describe all the changes made to program source
files.  The purpose of this is so that people investigating bugs in the
future will know about the changes that might have introduced the bug.
Often a new bug can be found by looking at what was recently changed.
More importantly, change logs can help you eliminate conceptual
inconsistencies between different parts of a program, by giving you a
history of how the conflicting concepts arose and who they came from.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Change-Log-Concepts">6.8.1 Change Log Concepts</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#Style-of-Change-Logs">6.8.2 Style of Change Logs</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#Simple-Changes">6.8.3 Simple Changes</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#Conditional-Changes">6.8.4 Conditional Changes</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#Indicating-the-Part-Changed">6.8.5 Indicating the Part Changed</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr size="6">
<a name="Change-Log-Concepts"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Change-Logs" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Style-of-Change-Logs" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Documentation" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Change-Logs" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Managing-Releases" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Change-Log-Concepts-1"></a>
<h3 class="subsection">6.8.1 Change Log Concepts</h3>

<p>You can think of the change log as a conceptual &ldquo;undo list&rdquo; which
explains how earlier versions were different from the current version.
People can see the current version; they don&rsquo;t need the change log
to tell them what is in it.  What they want from a change log is a
clear explanation of how the earlier version differed.
</p>
<p>The change log file is normally called &lsquo;<tt>ChangeLog</tt>&rsquo; and covers an
entire directory.  Each directory can have its own change log, or a
directory can use the change log of its parent directory&mdash;it&rsquo;s up to
you.
</p>
<p>Another alternative is to record change log information with a version
control system such as RCS or CVS.  This can be converted automatically
to a &lsquo;<tt>ChangeLog</tt>&rsquo; file using <code>rcs2log</code>; in Emacs, the command
<kbd>C-x v a</kbd> (<code>vc-update-change-log</code>) does the job.
</p>
<p>There&rsquo;s no need to describe the full purpose of the changes or how
they work together.  However, sometimes it is useful to write one line
to describe the overall purpose of a change or a batch of changes.  If
you think that a change calls for explanation, you&rsquo;re probably right.
Please do explain it&mdash;but please put the full explanation in comments
in the code, where people will see it whenever they see the code.  For
example, &ldquo;New function&rdquo; is enough for the change log when you add a
function, because there should be a comment before the function
definition to explain what it does.
</p>
<p>In the past, we recommended not mentioning changes in non-software
files (manuals, help files, etc.) in change logs.  However, we&rsquo;ve been
advised that it is a good idea to include them, for the sake of
copyright records.
</p>
<p>The easiest way to add an entry to &lsquo;<tt>ChangeLog</tt>&rsquo; is with the Emacs
command <kbd>M-x add-change-log-entry</kbd>.  An entry should have an
asterisk, the name of the changed file, and then in parentheses the name
of the changed functions, variables or whatever, followed by a colon.
Then describe the changes you made to that function or variable.
</p>
<hr size="6">
<a name="Style-of-Change-Logs"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Change-Log-Concepts" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Simple-Changes" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Documentation" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Change-Logs" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Managing-Releases" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Style-of-Change-Logs-1"></a>
<h3 class="subsection">6.8.2 Style of Change Logs</h3>
<a name="index-change-logs_002c-style"></a>

<p>Here are some simple examples of change log entries, starting with the
header line that says who made the change and when it was installed,
followed by descriptions of specific changes.  (These examples are
drawn from Emacs and GCC.)
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">1998-08-17  Richard Stallman  &lt;rms@gnu.org&gt;

* register.el (insert-register): Return nil.
(jump-to-register): Likewise.

* sort.el (sort-subr): Return nil.

* tex-mode.el (tex-bibtex-file, tex-file, tex-region):
Restart the tex shell if process is gone or stopped.
(tex-shell-running): New function.

* expr.c (store_one_arg): Round size up for move_block_to_reg.
(expand_call): Round up when emitting USE insns.
* stmt.c (assign_parms): Round size up for move_block_from_reg.
</pre></td></tr></table>

<p>It&rsquo;s important to name the changed function or variable in full.  Don&rsquo;t
abbreviate function or variable names, and don&rsquo;t combine them.
Subsequent maintainers will often search for a function name to find all
the change log entries that pertain to it; if you abbreviate the name,
they won&rsquo;t find it when they search.
</p>
<p>For example, some people are tempted to abbreviate groups of function
names by writing &lsquo;<samp>* register.el ({insert,jump-to}-register)</samp>&rsquo;;
this is not a good idea, since searching for <code>jump-to-register</code> or
<code>insert-register</code> would not find that entry.
</p>
<p>Separate unrelated change log entries with blank lines.  When two
entries represent parts of the same change, so that they work together,
then don&rsquo;t put blank lines between them.  Then you can omit the file
name and the asterisk when successive entries are in the same file.
</p>
<p>Break long lists of function names by closing continued lines with
&lsquo;<samp>)</samp>&rsquo;, rather than &lsquo;<samp>,</samp>&rsquo;, and opening the continuation with
&lsquo;<samp>(</samp>&rsquo; as in this example:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">* keyboard.c (menu_bar_items, tool_bar_items)
(Fexecute_extended_command): Deal with `keymap' property.
</pre></td></tr></table>

<p>When you install someone else&rsquo;s changes, put the contributor&rsquo;s name in
the change log entry rather than in the text of the entry.  In other
words, write this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">2002-07-14  John Doe  &lt;jdoe@gnu.org&gt;

        * sewing.c: Make it sew.
</pre></td></tr></table>

<p>rather than this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">2002-07-14  Usual Maintainer  &lt;usual@gnu.org&gt;

        * sewing.c: Make it sew.  Patch by jdoe@gnu.org.
</pre></td></tr></table>

<p>As for the date, that should be the date you applied the change.
</p>
<hr size="6">
<a name="Simple-Changes"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Style-of-Change-Logs" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Conditional-Changes" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Documentation" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Change-Logs" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Managing-Releases" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Simple-Changes-1"></a>
<h3 class="subsection">6.8.3 Simple Changes</h3>

<p>Certain simple kinds of changes don&rsquo;t need much detail in the change
log.
</p>
<p>When you change the calling sequence of a function in a simple fashion,
and you change all the callers of the function to use the new calling
sequence, there is no need to make individual entries for all the
callers that you changed.  Just write in the entry for the function
being called, &ldquo;All callers changed&rdquo;&mdash;like this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">* keyboard.c (Fcommand_execute): New arg SPECIAL.
All callers changed.
</pre></td></tr></table>

<p>When you change just comments or doc strings, it is enough to write an
entry for the file, without mentioning the functions.  Just &ldquo;Doc
fixes&rdquo; is enough for the change log.
</p>
<p>There&rsquo;s no technical need to make change log entries for documentation
files.  This is because documentation is not susceptible to bugs that
are hard to fix.  Documentation does not consist of parts that must
interact in a precisely engineered fashion.  To correct an error, you
need not know the history of the erroneous passage; it is enough to
compare what the documentation says with the way the program actually
works.
</p>
<p>However, you should keep change logs for documentation files when the
project gets copyright assignments from its contributors, so as to
make the records of authorship more accurate.
</p>
<hr size="6">
<a name="Conditional-Changes"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Simple-Changes" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Indicating-the-Part-Changed" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Documentation" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Change-Logs" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Managing-Releases" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Conditional-Changes-1"></a>
<h3 class="subsection">6.8.4 Conditional Changes</h3>
<a name="index-conditional-changes_002c-and-change-logs"></a>
<a name="index-change-logs_002c-conditional-changes"></a>

<p>C programs often contain compile-time <code>#if</code> conditionals.  Many
changes are conditional; sometimes you add a new definition which is
entirely contained in a conditional.  It is very useful to indicate in
the change log the conditions for which the change applies.
</p>
<p>Our convention for indicating conditional changes is to use square
brackets around the name of the condition.
</p>
<p>Here is a simple example, describing a change which is conditional but
does not have a function or entity name associated with it:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">* xterm.c [SOLARIS2]: Include string.h.
</pre></td></tr></table>

<p>Here is an entry describing a new definition which is entirely
conditional.  This new definition for the macro <code>FRAME_WINDOW_P</code> is
used only when <code>HAVE_X_WINDOWS</code> is defined:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">* frame.h [HAVE_X_WINDOWS] (FRAME_WINDOW_P): Macro defined.
</pre></td></tr></table>

<p>Here is an entry for a change within the function <code>init_display</code>,
whose definition as a whole is unconditional, but the changes themselves
are contained in a &lsquo;<samp>#ifdef HAVE_LIBNCURSES</samp>&rsquo; conditional:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">* dispnew.c (init_display) [HAVE_LIBNCURSES]: If X, call tgetent.
</pre></td></tr></table>

<p>Here is an entry for a change that takes affect only when
a certain macro is <em>not</em> defined:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(gethostname) [!HAVE_SOCKETS]: Replace with winsock version.
</pre></td></tr></table>

<hr size="6">
<a name="Indicating-the-Part-Changed"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Conditional-Changes" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Man-Pages" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Documentation" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Change-Logs" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Managing-Releases" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Indicating-the-Part-Changed-1"></a>
<h3 class="subsection">6.8.5 Indicating the Part Changed</h3>

<p>Indicate the part of a function which changed by using angle brackets
enclosing an indication of what the changed part does.  Here is an entry
for a change in the part of the function <code>sh-while-getopts</code> that
deals with <code>sh</code> commands:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">* progmodes/sh-script.el (sh-while-getopts) &lt;sh&gt;: Handle case that
user-specified option string is empty.
</pre></td></tr></table>


<hr size="6">
<a name="Man-Pages"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Indicating-the-Part-Changed" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Reading-other-Manuals" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Documentation" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Documentation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Managing-Releases" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Man-Pages-1"></a>
<h2 class="section">6.9 Man Pages</h2>
<a name="index-man-pages"></a>

<p>In the GNU project, man pages are secondary.  It is not necessary or
expected for every GNU program to have a man page, but some of them do.
It&rsquo;s your choice whether to include a man page in your program.
</p>
<p>When you make this decision, consider that supporting a man page
requires continual effort each time the program is changed.  The time
you spend on the man page is time taken away from more useful work.
</p>
<p>For a simple program which changes little, updating the man page may be
a small job.  Then there is little reason not to include a man page, if
you have one.
</p>
<p>For a large program that changes a great deal, updating a man page may
be a substantial burden.  If a user offers to donate a man page, you may
find this gift costly to accept.  It may be better to refuse the man
page unless the same person agrees to take full responsibility for
maintaining it&mdash;so that you can wash your hands of it entirely.  If
this volunteer later ceases to do the job, then don&rsquo;t feel obliged to
pick it up yourself; it may be better to withdraw the man page from the
distribution until someone else agrees to update it.
</p>
<p>When a program changes only a little, you may feel that the
discrepancies are small enough that the man page remains useful without
updating.  If so, put a prominent note near the beginning of the man
page explaining that you don&rsquo;t maintain it and that the Texinfo manual
is more authoritative.  The note should say how to access the Texinfo
documentation.
</p>
<p>Be sure that man pages include a copyright statement and free license.
The simple all-permissive license is appropriate for simple man pages
(see <a href="maintain.html#License-Notices-for-Other-Files">(maintain)License Notices for Other Files</a> section &lsquo;License Notices for Other Files&rsquo; in <cite>Information for GNU Maintainers</cite>).
</p>
<p>For long man pages, with enough explanation and documentation that
they can be considered true manuals, use the GFDL (see section <a href="#License-for-Manuals">License for Manuals</a>).
</p>
<p>Finally, the GNU help2man program
(<a href="http://www.gnu.org/software/help2man/">http://www.gnu.org/software/help2man/</a>) is one way to automate
generation of a man page, in this case from &lsquo;<samp>--help</samp>&rsquo; output.
This is sufficient in many cases.
</p>
<hr size="6">
<a name="Reading-other-Manuals"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Man-Pages" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Managing-Releases" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Documentation" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Documentation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Managing-Releases" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Reading-other-Manuals-1"></a>
<h2 class="section">6.10 Reading other Manuals</h2>

<p>There may be non-free books or documentation files that describe the
program you are documenting.
</p>
<p>It is ok to use these documents for reference, just as the author of a
new algebra textbook can read other books on algebra.  A large portion
of any non-fiction book consists of facts, in this case facts about how
a certain program works, and these facts are necessarily the same for
everyone who writes about the subject.  But be careful not to copy your
outline structure, wording, tables or examples from preexisting non-free
documentation.  Copying from free documentation may be ok; please check
with the FSF about the individual case.
</p>
<hr size="6">
<a name="Managing-Releases"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Reading-other-Manuals" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Configuration" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Documentation" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#References" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="The-Release-Process"></a>
<h1 class="chapter">7. The Release Process</h1>
<a name="index-releasing"></a>

<p>Making a release is more than just bundling up your source files in a
tar file and putting it up for FTP.  You should set up your software so
that it can be configured to run on a variety of systems.  Your Makefile
should conform to the GNU standards described below, and your directory
layout should also conform to the standards discussed below.  Doing so
makes it easy to include your package into the larger framework of
all GNU software.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Configuration">7.1 How Configuration Should Work</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">               How configuration of GNU packages should work.
</td></tr>
<tr><td align="left" valign="top"><a href="#Makefile-Conventions">7.2 Makefile Conventions</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">        Makefile conventions.
</td></tr>
<tr><td align="left" valign="top"><a href="#Releases">7.3 Making Releases</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                    Making releases
</td></tr>
</table>

<hr size="6">
<a name="Configuration"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Managing-Releases" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Makefile-Conventions" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Managing-Releases" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Managing-Releases" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#References" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="How-Configuration-Should-Work"></a>
<h2 class="section">7.1 How Configuration Should Work</h2>
<a name="index-program-configuration"></a>

<a name="index-configure"></a>
<p>Each GNU distribution should come with a shell script named
<code>configure</code>.  This script is given arguments which describe the
kind of machine and system you want to compile the program for.
The <code>configure</code> script must record the configuration options so
that they affect compilation.
</p>
<p>The description here is the specification of the interface for the
<code>configure</code> script in GNU packages.  Many packages implement it
using GNU Autoconf (see <a href="autoconf.html#Top">(autoconf)Top</a> section &lsquo;Introduction&rsquo; in <cite>Autoconf</cite>)
and/or GNU Automake (see <a href="automake.html#Top">(automake)Top</a> section &lsquo;Introduction&rsquo; in <cite>Automake</cite>),
but you do not have to use these tools.  You can implement it any way
you like; for instance, by making <code>configure</code> be a wrapper around
a completely different configuration system.
</p>
<p>Another way for the <code>configure</code> script to operate is to make a
link from a standard name such as &lsquo;<tt>config.h</tt>&rsquo; to the proper
configuration file for the chosen system.  If you use this technique,
the distribution should <em>not</em> contain a file named
&lsquo;<tt>config.h</tt>&rsquo;.  This is so that people won&rsquo;t be able to build the
program without configuring it first.
</p>
<p>Another thing that <code>configure</code> can do is to edit the Makefile.  If
you do this, the distribution should <em>not</em> contain a file named
&lsquo;<tt>Makefile</tt>&rsquo;.  Instead, it should include a file &lsquo;<tt>Makefile.in</tt>&rsquo; which
contains the input used for editing.  Once again, this is so that people
won&rsquo;t be able to build the program without configuring it first.
</p>
<p>If <code>configure</code> does write the &lsquo;<tt>Makefile</tt>&rsquo;, then &lsquo;<tt>Makefile</tt>&rsquo;
should have a target named &lsquo;<tt>Makefile</tt>&rsquo; which causes <code>configure</code>
to be rerun, setting up the same configuration that was set up last
time.  The files that <code>configure</code> reads should be listed as
dependencies of &lsquo;<tt>Makefile</tt>&rsquo;.
</p>
<p>All the files which are output from the <code>configure</code> script should
have comments at the beginning explaining that they were generated
automatically using <code>configure</code>.  This is so that users won&rsquo;t think
of trying to edit them by hand.
</p>
<p>The <code>configure</code> script should write a file named &lsquo;<tt>config.status</tt>&rsquo;
which describes which configuration options were specified when the
program was last configured.  This file should be a shell script which,
if run, will recreate the same configuration.
</p>
<p>The <code>configure</code> script should accept an option of the form
&lsquo;<samp>--srcdir=<var>dirname</var></samp>&rsquo; to specify the directory where sources are found
(if it is not the current directory).  This makes it possible to build
the program in a separate directory, so that the actual source directory
is not modified.
</p>
<p>If the user does not specify &lsquo;<samp>--srcdir</samp>&rsquo;, then <code>configure</code> should
check both &lsquo;<tt>.</tt>&rsquo; and &lsquo;<tt>..</tt>&rsquo; to see if it can find the sources.  If
it finds the sources in one of these places, it should use them from
there.  Otherwise, it should report that it cannot find the sources, and
should exit with nonzero status.
</p>
<p>Usually the easy way to support &lsquo;<samp>--srcdir</samp>&rsquo; is by editing a
definition of <code>VPATH</code> into the Makefile.  Some rules may need to
refer explicitly to the specified source directory.  To make this
possible, <code>configure</code> can add to the Makefile a variable named
<code>srcdir</code> whose value is precisely the specified directory.
</p>
<p>In addition, the &lsquo;<samp>configure</samp>&rsquo; script should take options
corresponding to most of the standard directory variables
(see section <a href="#Directory-Variables">Variables for Installation Directories</a>).  Here is the list:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">--prefix --exec-prefix --bindir --sbindir --libexecdir --sysconfdir
--sharedstatedir --localstatedir --libdir --includedir --oldincludedir
--datarootdir --datadir --infodir --localedir --mandir --docdir
--htmldir --dvidir --pdfdir --psdir
</pre></td></tr></table>

<p>The <code>configure</code> script should also take an argument which specifies the
type of system to build the program for.  This argument should look like
this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example"><var>cpu</var>-<var>company</var>-<var>system</var>
</pre></td></tr></table>

<p>For example, an Athlon-based GNU/Linux system might be
&lsquo;<samp>i686-pc-linux-gnu</samp>&rsquo;.
</p>
<p>The <code>configure</code> script needs to be able to decode all plausible
alternatives for how to describe a machine.  Thus,
&lsquo;<samp>athlon-pc-gnu/linux</samp>&rsquo; would be a valid alias.  There is a shell
script called
<a href="http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD">&lsquo;<tt>config.sub</tt>&rsquo;</a> that you can use as a subroutine to validate system
types and canonicalize aliases.
</p>
<p>The <code>configure</code> script should also take the option
&lsquo;<samp>--build=<var>buildtype</var></samp>&rsquo;, which should be equivalent to a
plain <var>buildtype</var> argument.  For example, &lsquo;<samp>configure
--build=i686-pc-linux-gnu</samp>&rsquo; is equivalent to &lsquo;<samp>configure
i686-pc-linux-gnu</samp>&rsquo;.  When the build type is not specified by an option
or argument, the <code>configure</code> script should normally guess it using
the shell script
<a href="http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD">&lsquo;<tt>config.guess</tt>&rsquo;</a>.
</p>
<a name="index-optional-features_002c-configure_002dtime"></a>
<p>Other options are permitted to specify in more detail the software
or hardware present on the machine, to include or exclude optional parts
of the package, or to adjust the name of some tools or arguments to them:
</p>
<dl compact="compact">
<dt> &lsquo;<samp>--enable-<var>feature</var><span class="roman">[</span>=<var>parameter</var><span class="roman">]</span></samp>&rsquo;</dt>
<dd><p>Configure the package to build and install an optional user-level
facility called <var>feature</var>.  This allows users to choose which
optional features to include.  Giving an optional <var>parameter</var> of
&lsquo;<samp>no</samp>&rsquo; should omit <var>feature</var>, if it is built by default.
</p>
<p>No &lsquo;<samp>--enable</samp>&rsquo; option should <strong>ever</strong> cause one feature to
replace another.  No &lsquo;<samp>--enable</samp>&rsquo; option should ever substitute one
useful behavior for another useful behavior.  The only proper use for
&lsquo;<samp>--enable</samp>&rsquo; is for questions of whether to build part of the program
or exclude it.
</p>
</dd>
<dt> &lsquo;<samp>--with-<var>package</var></samp>&rsquo;</dt>
<dd><p>The package <var>package</var> will be installed, so configure this package
to work with <var>package</var>.
</p>

<p>Possible values of <var>package</var> include
&lsquo;<samp>gnu-as</samp>&rsquo; (or &lsquo;<samp>gas</samp>&rsquo;), &lsquo;<samp>gnu-ld</samp>&rsquo;, &lsquo;<samp>gnu-libc</samp>&rsquo;,
&lsquo;<samp>gdb</samp>&rsquo;,
&lsquo;<samp>x</samp>&rsquo;,
and
&lsquo;<samp>x-toolkit</samp>&rsquo;.
</p>
<p>Do not use a &lsquo;<samp>--with</samp>&rsquo; option to specify the file name to use to
find certain files.  That is outside the scope of what &lsquo;<samp>--with</samp>&rsquo;
options are for.
</p>
</dd>
<dt> &lsquo;<samp><var>variable</var>=<var>value</var></samp>&rsquo;</dt>
<dd><p>Set the value of the variable <var>variable</var> to <var>value</var>.  This is
used to override the default values of commands or arguments in the
build process.  For example, the user could issue &lsquo;<samp>configure
CFLAGS=-g CXXFLAGS=-g</samp>&rsquo; to build with debugging information and without
the default optimization.
</p>
<p>Specifying variables as arguments to <code>configure</code>, like this:
</p><table><tr><td>&nbsp;</td><td><pre class="example">./configure CC=gcc
</pre></td></tr></table>
<p>is preferable to setting them in environment variables:
</p><table><tr><td>&nbsp;</td><td><pre class="example">CC=gcc ./configure
</pre></td></tr></table>
<p>as it helps to recreate the same configuration later with
&lsquo;<tt>config.status</tt>&rsquo;.  However, both methods should be supported.
</p></dd>
</dl>

<p>All <code>configure</code> scripts should accept all of the &ldquo;detail&rdquo;
options and the variable settings, whether or not they make any
difference to the particular package at hand.  In particular, they
should accept any option that starts with &lsquo;<samp>--with-</samp>&rsquo; or
&lsquo;<samp>--enable-</samp>&rsquo;.  This is so users will be able to configure an
entire GNU source tree at once with a single set of options.
</p>
<p>You will note that the categories &lsquo;<samp>--with-</samp>&rsquo; and &lsquo;<samp>--enable-</samp>&rsquo;
are narrow: they <strong>do not</strong> provide a place for any sort of option
you might think of.  That is deliberate.  We want to limit the possible
configuration options in GNU software.  We do not want GNU programs to
have idiosyncratic configuration options.
</p>
<p>Packages that perform part of the compilation process may support
cross-compilation.  In such a case, the host and target machines for the
program may be different.
</p>
<p>The <code>configure</code> script should normally treat the specified type of
system as both the host and the target, thus producing a program which
works for the same type of machine that it runs on.
</p>
<p>To compile a program to run on a host type that differs from the build
type, use the configure option &lsquo;<samp>--host=<var>hosttype</var></samp>&rsquo;, where
<var>hosttype</var> uses the same syntax as <var>buildtype</var>.  The host type
normally defaults to the build type.
</p>
<p>To configure a cross-compiler, cross-assembler, or what have you, you
should specify a target different from the host, using the configure
option &lsquo;<samp>--target=<var>targettype</var></samp>&rsquo;.  The syntax for
<var>targettype</var> is the same as for the host type.  So the command would
look like this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">./configure --host=<var>hosttype</var> --target=<var>targettype</var>
</pre></td></tr></table>

<p>The target type normally defaults to the host type.
Programs for which cross-operation is not meaningful need not accept the
&lsquo;<samp>--target</samp>&rsquo; option, because configuring an entire operating system for
cross-operation is not a meaningful operation.
</p>
<p>Some programs have ways of configuring themselves automatically.  If
your program is set up to do this, your <code>configure</code> script can simply
ignore most of its arguments.
</p>

<hr size="6">
<a name="Makefile-Conventions"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Configuration" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Makefile-Basics" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Managing-Releases" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Managing-Releases" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#References" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Makefile-Conventions-1"></a>
<h2 class="section">7.2 Makefile Conventions</h2>
<a name="index-makefile_002c-conventions-for"></a>
<a name="index-conventions-for-makefiles"></a>
<a name="index-standards-for-makefiles"></a>


<p>This
describes conventions for writing the Makefiles for GNU programs.
Using Automake will help you write a Makefile that follows these
conventions.  For more information on portable Makefiles, see
<small>POSIX</small> and <a href="autoconf.html#Portable-Make">Portable Make Programming: (autoconf)Portable Make</a> section &lsquo;Portable Make&rsquo; in <cite>Autoconf</cite>.
</p>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Makefile-Basics">7.2.1 General Conventions for Makefiles</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">             General conventions for Makefiles.
</td></tr>
<tr><td align="left" valign="top"><a href="#Utilities-in-Makefiles">7.2.2 Utilities in Makefiles</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">      Utilities to be used in Makefiles.
</td></tr>
<tr><td align="left" valign="top"><a href="#Command-Variables">7.2.3 Variables for Specifying Commands</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">           Variables for specifying commands.
</td></tr>
<tr><td align="left" valign="top"><a href="#DESTDIR">7.2.4 <code>DESTDIR</code>: Support for Staged Installs</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                     Supporting staged installs.
</td></tr>
<tr><td align="left" valign="top"><a href="#Directory-Variables">7.2.5 Variables for Installation Directories</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">         Variables for installation directories.
</td></tr>
<tr><td align="left" valign="top"><a href="#Standard-Targets">7.2.6 Standard Targets for Users</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">            Standard targets for users.
</td></tr>
<tr><td align="left" valign="top"><a href="#Install-Command-Categories">7.2.7 Install Command Categories</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">  Three categories of commands in the &lsquo;install&rsquo;
                                  rule: normal, pre-install and post-install.
</td></tr>
</table>

<hr size="6">
<a name="Makefile-Basics"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Makefile-Conventions" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Utilities-in-Makefiles" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Managing-Releases" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Makefile-Conventions" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#References" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="General-Conventions-for-Makefiles"></a>
<h3 class="subsection">7.2.1 General Conventions for Makefiles</h3>

<p>Every Makefile should contain this line:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">SHELL = /bin/sh
</pre></td></tr></table>

<p>to avoid trouble on systems where the <code>SHELL</code> variable might be
inherited from the environment.  (This is never a problem with GNU
<code>make</code>.)
</p>
<p>Different <code>make</code> programs have incompatible suffix lists and
implicit rules, and this sometimes creates confusion or misbehavior.  So
it is a good idea to set the suffix list explicitly using only the
suffixes you need in the particular Makefile, like this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">.SUFFIXES:
.SUFFIXES: .c .o
</pre></td></tr></table>

<p>The first line clears out the suffix list, the second introduces all
suffixes which may be subject to implicit rules in this Makefile.
</p>
<p>Don&rsquo;t assume that &lsquo;<tt>.</tt>&rsquo; is in the path for command execution.  When
you need to run programs that are a part of your package during the
make, please make sure that it uses &lsquo;<tt>./</tt>&rsquo; if the program is built as
part of the make or &lsquo;<tt>$(srcdir)/</tt>&rsquo; if the file is an unchanging part
of the source code.  Without one of these prefixes, the current search
path is used.
</p>
<p>The distinction between &lsquo;<tt>./</tt>&rsquo; (the <em>build directory</em>) and
&lsquo;<tt>$(srcdir)/</tt>&rsquo; (the <em>source directory</em>) is important because
users can build in a separate directory using the &lsquo;<samp>--srcdir</samp>&rsquo; option
to &lsquo;<tt>configure</tt>&rsquo;.  A rule of the form:
</p>
<table><tr><td>&nbsp;</td><td><pre class="smallexample">foo.1 : foo.man sedscript
        sed -f sedscript foo.man &gt; foo.1
</pre></td></tr></table>

<p>will fail when the build directory is not the source directory, because
&lsquo;<tt>foo.man</tt>&rsquo; and &lsquo;<tt>sedscript</tt>&rsquo; are in the source directory.
</p>
<p>When using GNU <code>make</code>, relying on &lsquo;<samp>VPATH</samp>&rsquo; to find the source
file will work in the case where there is a single dependency file,
since the <code>make</code> automatic variable &lsquo;<samp>$&lt;</samp>&rsquo; will represent the
source file wherever it is.  (Many versions of <code>make</code> set &lsquo;<samp>$&lt;</samp>&rsquo;
only in implicit rules.)  A Makefile target like
</p>
<table><tr><td>&nbsp;</td><td><pre class="smallexample">foo.o : bar.c
        $(CC) -I. -I$(srcdir) $(CFLAGS) -c bar.c -o foo.o
</pre></td></tr></table>

<p>should instead be written as
</p>
<table><tr><td>&nbsp;</td><td><pre class="smallexample">foo.o : bar.c
        $(CC) -I. -I$(srcdir) $(CFLAGS) -c $&lt; -o $@
</pre></td></tr></table>

<p>in order to allow &lsquo;<samp>VPATH</samp>&rsquo; to work correctly.  When the target has
multiple dependencies, using an explicit &lsquo;<samp>$(srcdir)</samp>&rsquo; is the easiest
way to make the rule work well.  For example, the target above for
&lsquo;<tt>foo.1</tt>&rsquo; is best written as:
</p>
<table><tr><td>&nbsp;</td><td><pre class="smallexample">foo.1 : foo.man sedscript
        sed -f $(srcdir)/sedscript $(srcdir)/foo.man &gt; $@
</pre></td></tr></table>

<p>GNU distributions usually contain some files which are not source
files&mdash;for example, Info files, and the output from Autoconf, Automake,
Bison or Flex.  Since these files normally appear in the source
directory, they should always appear in the source directory, not in the
build directory.  So Makefile rules to update them should put the
updated files in the source directory.
</p>
<p>However, if a file does not appear in the distribution, then the
Makefile should not put it in the source directory, because building a
program in ordinary circumstances should not modify the source directory
in any way.
</p>
<p>Try to make the build and installation targets, at least (and all their
subtargets) work correctly with a parallel <code>make</code>.
</p>
<hr size="6">
<a name="Utilities-in-Makefiles"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Makefile-Basics" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Command-Variables" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Managing-Releases" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Makefile-Conventions" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#References" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Utilities-in-Makefiles-1"></a>
<h3 class="subsection">7.2.2 Utilities in Makefiles</h3>

<p>Write the Makefile commands (and any shell scripts, such as
<code>configure</code>) to run under <code>sh</code> (both the traditional Bourne
shell and the <small>POSIX</small> shell), not <code>csh</code>.  Don&rsquo;t use any
special features of <code>ksh</code> or <code>bash</code>, or <small>POSIX</small> features
not widely supported in traditional Bourne <code>sh</code>.
</p>
<p>The <code>configure</code> script and the Makefile rules for building and
installation should not use any utilities directly except these:
</p>

<table><tr><td>&nbsp;</td><td><pre class="example">awk cat cmp cp diff echo egrep expr false grep install-info ln ls
mkdir mv printf pwd rm rmdir sed sleep sort tar test touch tr true
</pre></td></tr></table>

<p>Compression programs such as <code>gzip</code> can be used in the
<code>dist</code> rule.
</p>
<p>Generally, stick to the widely-supported (usually
<small>POSIX</small>-specified) options and features of these programs.  For
example, don&rsquo;t use &lsquo;<samp>mkdir -p</samp>&rsquo;, convenient as it may be, because a
few systems don&rsquo;t support it at all and with others, it is not safe
for parallel execution.  For a list of known incompatibilities, see
<a href="autoconf.html#Portable-Shell">Portable Shell Programming: (autoconf)Portable Shell</a> section &lsquo;Portable Shell&rsquo; in <cite>Autoconf</cite>.
</p>

<p>It is a good idea to avoid creating symbolic links in makefiles, since a
few file systems don&rsquo;t support them.
</p>
<p>The Makefile rules for building and installation can also use compilers
and related programs, but should do so via <code>make</code> variables so that the
user can substitute alternatives.  Here are some of the programs we
mean:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">ar bison cc flex install ld ldconfig lex
make makeinfo ranlib texi2dvi yacc
</pre></td></tr></table>

<p>Use the following <code>make</code> variables to run those programs:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">$(AR) $(BISON) $(CC) $(FLEX) $(INSTALL) $(LD) $(LDCONFIG) $(LEX)
$(MAKE) $(MAKEINFO) $(RANLIB) $(TEXI2DVI) $(YACC)
</pre></td></tr></table>

<p>When you use <code>ranlib</code> or <code>ldconfig</code>, you should make sure
nothing bad happens if the system does not have the program in question.
Arrange to ignore an error from that command, and print a message before
the command to tell the user that failure of this command does not mean
a problem.  (The Autoconf &lsquo;<samp>AC_PROG_RANLIB</samp>&rsquo; macro can help with
this.)
</p>
<p>If you use symbolic links, you should implement a fallback for systems
that don&rsquo;t have symbolic links.
</p>
<p>Additional utilities that can be used via Make variables are:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">chgrp chmod chown mknod
</pre></td></tr></table>

<p>It is ok to use other utilities in Makefile portions (or scripts)
intended only for particular systems where you know those utilities
exist.
</p>
<hr size="6">
<a name="Command-Variables"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Utilities-in-Makefiles" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#DESTDIR" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Managing-Releases" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Makefile-Conventions" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#References" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Variables-for-Specifying-Commands"></a>
<h3 class="subsection">7.2.3 Variables for Specifying Commands</h3>

<p>Makefiles should provide variables for overriding certain commands, options,
and so on.
</p>
<p>In particular, you should run most utility programs via variables.
Thus, if you use Bison, have a variable named <code>BISON</code> whose default
value is set with &lsquo;<samp>BISON = bison</samp>&rsquo;, and refer to it with
<code>$(BISON)</code> whenever you need to use Bison.
</p>
<p>File management utilities such as <code>ln</code>, <code>rm</code>, <code>mv</code>, and
so on, need not be referred to through variables in this way, since users
don&rsquo;t need to replace them with other programs.
</p>
<p>Each program-name variable should come with an options variable that is
used to supply options to the program.  Append &lsquo;<samp>FLAGS</samp>&rsquo; to the
program-name variable name to get the options variable name&mdash;for
example, <code>BISONFLAGS</code>.  (The names <code>CFLAGS</code> for the C
compiler, <code>YFLAGS</code> for yacc, and <code>LFLAGS</code> for lex, are
exceptions to this rule, but we keep them because they are standard.)
Use <code>CPPFLAGS</code> in any compilation command that runs the
preprocessor, and use <code>LDFLAGS</code> in any compilation command that
does linking as well as in any direct use of <code>ld</code>.
</p>
<p>If there are C compiler options that <em>must</em> be used for proper
compilation of certain files, do not include them in <code>CFLAGS</code>.
Users expect to be able to specify <code>CFLAGS</code> freely themselves.
Instead, arrange to pass the necessary options to the C compiler
independently of <code>CFLAGS</code>, by writing them explicitly in the
compilation commands or by defining an implicit rule, like this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="smallexample">CFLAGS = -g
ALL_CFLAGS = -I. $(CFLAGS)
.c.o:
        $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $&lt;
</pre></td></tr></table>

<p>Do include the &lsquo;<samp>-g</samp>&rsquo; option in <code>CFLAGS</code>, because that is not
<em>required</em> for proper compilation.  You can consider it a default
that is only recommended.  If the package is set up so that it is
compiled with GCC by default, then you might as well include &lsquo;<samp>-O</samp>&rsquo;
in the default value of <code>CFLAGS</code> as well.
</p>
<p>Put <code>CFLAGS</code> last in the compilation command, after other variables
containing compiler options, so the user can use <code>CFLAGS</code> to
override the others.
</p>
<p><code>CFLAGS</code> should be used in every invocation of the C compiler,
both those which do compilation and those which do linking.
</p>
<p>Every Makefile should define the variable <code>INSTALL</code>, which is the
basic command for installing a file into the system.
</p>
<p>Every Makefile should also define the variables <code>INSTALL_PROGRAM</code>
and <code>INSTALL_DATA</code>.  (The default for <code>INSTALL_PROGRAM</code> should
be <code>$(INSTALL)</code>; the default for <code>INSTALL_DATA</code> should be
<code>${INSTALL} -m 644</code>.)  Then it should use those variables as the
commands for actual installation, for executables and non-executables
respectively.  Minimal use of these variables is as follows:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">$(INSTALL_PROGRAM) foo $(bindir)/foo
$(INSTALL_DATA) libfoo.a $(libdir)/libfoo.a
</pre></td></tr></table>

<p>However, it is preferable to support a <code>DESTDIR</code> prefix on the
target files, as explained in the next section.
</p>
<p>It is acceptable, but not required, to install multiple files in one
command, with the final argument being a directory, as in:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">$(INSTALL_PROGRAM) foo bar baz $(bindir)
</pre></td></tr></table>


<hr size="6">
<a name="DESTDIR"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Command-Variables" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Directory-Variables" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Managing-Releases" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Makefile-Conventions" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#References" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="DESTDIR_003a-Support-for-Staged-Installs"></a>
<h3 class="subsection">7.2.4 <code>DESTDIR</code>: Support for Staged Installs</h3>

<a name="index-DESTDIR"></a>
<a name="index-staged-installs"></a>
<a name="index-installations_002c-staged"></a>

<p><code>DESTDIR</code> is a variable prepended to each installed target file,
like this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">$(INSTALL_PROGRAM) foo $(DESTDIR)$(bindir)/foo
$(INSTALL_DATA) libfoo.a $(DESTDIR)$(libdir)/libfoo.a
</pre></td></tr></table>

<p>The <code>DESTDIR</code> variable is specified by the user on the <code>make</code>
command line as an absolute file name.  For example:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">make DESTDIR=/tmp/stage install
</pre></td></tr></table>

<p><code>DESTDIR</code> should be supported only in the <code>install*</code> and
<code>uninstall*</code> targets, as those are the only targets where it is
useful.
</p>
<p>If your installation step would normally install
&lsquo;<tt>/usr/local/bin/foo</tt>&rsquo; and &lsquo;<tt>/usr/local/lib/libfoo.a</tt>&rsquo;, then an
installation invoked as in the example above would install
&lsquo;<tt>/tmp/stage/usr/local/bin/foo</tt>&rsquo; and
&lsquo;<tt>/tmp/stage/usr/local/lib/libfoo.a</tt>&rsquo; instead.
</p>
<p>Prepending the variable <code>DESTDIR</code> to each target in this way
provides for <em>staged installs</em>, where the installed files are not
placed directly into their expected location but are instead copied
into a temporary location (<code>DESTDIR</code>).  However, installed files
maintain their relative directory structure and any embedded file names
will not be modified.
</p>
<p>You should not set the value of <code>DESTDIR</code> in your &lsquo;<tt>Makefile</tt>&rsquo;
at all; then the files are installed into their expected locations by
default.  Also, specifying <code>DESTDIR</code> should not change the
operation of the software in any way, so its value should not be
included in any file contents.
</p>
<p><code>DESTDIR</code> support is commonly used in package creation.  It is
also helpful to users who want to understand what a given package will
install where, and to allow users who don&rsquo;t normally have permissions
to install into protected areas to build and install before gaining
those permissions.  Finally, it can be useful with tools such as
<code>stow</code>, where code is installed in one place but made to appear
to be installed somewhere else using symbolic links or special mount
operations.  So, we strongly recommend GNU packages support
<code>DESTDIR</code>, though it is not an absolute requirement.
</p>

<hr size="6">
<a name="Directory-Variables"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#DESTDIR" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Standard-Targets" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Managing-Releases" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Makefile-Conventions" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#References" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Variables-for-Installation-Directories"></a>
<h3 class="subsection">7.2.5 Variables for Installation Directories</h3>

<p>Installation directories should always be named by variables, so it is
easy to install in a nonstandard place.  The standard names for these
variables and the values they should have in GNU packages are
described below.  They are based on a standard file system layout;
variants of it are used in GNU/Linux and other modern operating
systems.
</p>
<p>Installers are expected to override these values when calling
<code>make</code> (e.g., <kbd>make prefix=/usr install</kbd> or
<code>configure</code> (e.g., <kbd>configure --prefix=/usr</kbd>).  GNU
packages should not try to guess which value should be appropriate for
these variables on the system they are being installed onto: use the
default settings specified here so that all GNU packages behave
identically, allowing the installer to achieve any desired layout.
</p>
<a name="index-directories_002c-creating-installation"></a>
<a name="index-installation-directories_002c-creating"></a>
<p>All installation directories, and their parent directories, should be
created (if necessary) before they are installed into.
</p>
<p>These first two variables set the root for the installation.  All the
other installation directories should be subdirectories of one of
these two, and nothing should be directly installed into these two
directories.
</p>
<dl compact="compact">
<dt> <code>prefix</code></dt>
<dd><a name="index-prefix"></a>
<p>A prefix used in constructing the default values of the variables listed
below.  The default value of <code>prefix</code> should be &lsquo;<tt>/usr/local</tt>&rsquo;.
When building the complete GNU system, the prefix will be empty and
&lsquo;<tt>/usr</tt>&rsquo; will be a symbolic link to &lsquo;<tt>/</tt>&rsquo;.
(If you are using Autoconf, write it as &lsquo;<samp>@prefix@</samp>&rsquo;.)
</p>
<p>Running &lsquo;<samp>make install</samp>&rsquo; with a different value of <code>prefix</code> from
the one used to build the program should <em>not</em> recompile the
program.
</p>
</dd>
<dt> <code>exec_prefix</code></dt>
<dd><a name="index-exec_005fprefix"></a>
<p>A prefix used in constructing the default values of some of the
variables listed below.  The default value of <code>exec_prefix</code> should
be <code>$(prefix)</code>.
(If you are using Autoconf, write it as &lsquo;<samp>@exec_prefix@</samp>&rsquo;.)
</p>
<p>Generally, <code>$(exec_prefix)</code> is used for directories that contain
machine-specific files (such as executables and subroutine libraries),
while <code>$(prefix)</code> is used directly for other directories.
</p>
<p>Running &lsquo;<samp>make install</samp>&rsquo; with a different value of <code>exec_prefix</code>
from the one used to build the program should <em>not</em> recompile the
program.
</p></dd>
</dl>

<p>Executable programs are installed in one of the following directories.
</p>
<dl compact="compact">
<dt> <code>bindir</code></dt>
<dd><a name="index-bindir"></a>
<p>The directory for installing executable programs that users can run.
This should normally be &lsquo;<tt>/usr/local/bin</tt>&rsquo;, but write it as
&lsquo;<tt>$(exec_prefix)/bin</tt>&rsquo;.
(If you are using Autoconf, write it as &lsquo;<samp>@bindir@</samp>&rsquo;.)
</p>
</dd>
<dt> <code>sbindir</code></dt>
<dd><a name="index-sbindir"></a>
<p>The directory for installing executable programs that can be run from
the shell, but are only generally useful to system administrators.  This
should normally be &lsquo;<tt>/usr/local/sbin</tt>&rsquo;, but write it as
&lsquo;<tt>$(exec_prefix)/sbin</tt>&rsquo;.
(If you are using Autoconf, write it as &lsquo;<samp>@sbindir@</samp>&rsquo;.)
</p>
</dd>
<dt> <code>libexecdir</code></dt>
<dd><a name="index-libexecdir"></a>
<p>The directory for installing executable programs to be run by other
programs rather than by users.  This directory should normally be
&lsquo;<tt>/usr/local/libexec</tt>&rsquo;, but write it as &lsquo;<tt>$(exec_prefix)/libexec</tt>&rsquo;.
(If you are using Autoconf, write it as &lsquo;<samp>@libexecdir@</samp>&rsquo;.)
</p>
<p>The definition of &lsquo;<samp>libexecdir</samp>&rsquo; is the same for all packages, so
you should install your data in a subdirectory thereof.  Most packages
install their data under &lsquo;<tt>$(libexecdir)/<var>package-name</var>/</tt>&rsquo;,
possibly within additional subdirectories thereof, such as
&lsquo;<tt>$(libexecdir)/<var>package-name</var>/<var>machine</var>/<var>version</var></tt>&rsquo;.
</p></dd>
</dl>

<p>Data files used by the program during its execution are divided into
categories in two ways.
</p>
<ul>
<li>
Some files are normally modified by programs; others are never normally
modified (though users may edit some of these).

</li><li>
Some files are architecture-independent and can be shared by all
machines at a site; some are architecture-dependent and can be shared
only by machines of the same kind and operating system; others may never
be shared between two machines.
</li></ul>

<p>This makes for six different possibilities.  However, we want to
discourage the use of architecture-dependent files, aside from object
files and libraries.  It is much cleaner to make other data files
architecture-independent, and it is generally not hard.
</p>
<p>Here are the variables Makefiles should use to specify directories
to put these various kinds of files in:
</p>
<dl compact="compact">
<dt> &lsquo;<samp>datarootdir</samp>&rsquo;</dt>
<dd><p>The root of the directory tree for read-only architecture-independent
data files.  This should normally be &lsquo;<tt>/usr/local/share</tt>&rsquo;, but
write it as &lsquo;<tt>$(prefix)/share</tt>&rsquo;.  (If you are using Autoconf, write
it as &lsquo;<samp>@datarootdir@</samp>&rsquo;.)  &lsquo;<samp>datadir</samp>&rsquo;&rsquo;s default value is
based on this variable; so are &lsquo;<samp>infodir</samp>&rsquo;, &lsquo;<samp>mandir</samp>&rsquo;, and
others.
</p>
</dd>
<dt> &lsquo;<samp>datadir</samp>&rsquo;</dt>
<dd><p>The directory for installing idiosyncratic read-only
architecture-independent data files for this program.  This is usually
the same place as &lsquo;<samp>datarootdir</samp>&rsquo;, but we use the two separate
variables so that you can move these program-specific files without
altering the location for Info files, man pages, etc.
</p>
<p>This should normally be &lsquo;<tt>/usr/local/share</tt>&rsquo;, but write it as
&lsquo;<tt>$(datarootdir)</tt>&rsquo;.  (If you are using Autoconf, write it as
&lsquo;<samp>@datadir@</samp>&rsquo;.)
</p>
<p>The definition of &lsquo;<samp>datadir</samp>&rsquo; is the same for all packages, so you
should install your data in a subdirectory thereof.  Most packages
install their data under &lsquo;<tt>$(datadir)/<var>package-name</var>/</tt>&rsquo;.
</p>
</dd>
<dt> &lsquo;<samp>sysconfdir</samp>&rsquo;</dt>
<dd><p>The directory for installing read-only data files that pertain to a
single machine&ndash;that is to say, files for configuring a host.  Mailer
and network configuration files, &lsquo;<tt>/etc/passwd</tt>&rsquo;, and so forth belong
here.  All the files in this directory should be ordinary ASCII text
files.  This directory should normally be &lsquo;<tt>/usr/local/etc</tt>&rsquo;, but
write it as &lsquo;<tt>$(prefix)/etc</tt>&rsquo;.
(If you are using Autoconf, write it as &lsquo;<samp>@sysconfdir@</samp>&rsquo;.)
</p>
<p>Do not install executables here in this directory (they probably belong
in &lsquo;<tt>$(libexecdir)</tt>&rsquo; or &lsquo;<tt>$(sbindir)</tt>&rsquo;).  Also do not install
files that are modified in the normal course of their use (programs
whose purpose is to change the configuration of the system excluded).
Those probably belong in &lsquo;<tt>$(localstatedir)</tt>&rsquo;.
</p>
</dd>
<dt> &lsquo;<samp>sharedstatedir</samp>&rsquo;</dt>
<dd><p>The directory for installing architecture-independent data files which
the programs modify while they run.  This should normally be
&lsquo;<tt>/usr/local/com</tt>&rsquo;, but write it as &lsquo;<tt>$(prefix)/com</tt>&rsquo;.
(If you are using Autoconf, write it as &lsquo;<samp>@sharedstatedir@</samp>&rsquo;.)
</p>
</dd>
<dt> &lsquo;<samp>localstatedir</samp>&rsquo;</dt>
<dd><p>The directory for installing data files which the programs modify while
they run, and that pertain to one specific machine.  Users should never
need to modify files in this directory to configure the package&rsquo;s
operation; put such configuration information in separate files that go
in &lsquo;<tt>$(datadir)</tt>&rsquo; or &lsquo;<tt>$(sysconfdir)</tt>&rsquo;.  &lsquo;<tt>$(localstatedir)</tt>&rsquo;
should normally be &lsquo;<tt>/usr/local/var</tt>&rsquo;, but write it as
&lsquo;<tt>$(prefix)/var</tt>&rsquo;.
(If you are using Autoconf, write it as &lsquo;<samp>@localstatedir@</samp>&rsquo;.)
</p></dd>
</dl>

<p>These variables specify the directory for installing certain specific
types of files, if your program has them.  Every GNU package should
have Info files, so every program needs &lsquo;<samp>infodir</samp>&rsquo;, but not all
need &lsquo;<samp>libdir</samp>&rsquo; or &lsquo;<samp>lispdir</samp>&rsquo;.
</p>
<dl compact="compact">
<dt> &lsquo;<samp>includedir</samp>&rsquo;</dt>
<dd><p>The directory for installing header files to be included by user
programs with the C &lsquo;<samp>#include</samp>&rsquo; preprocessor directive.  This
should normally be &lsquo;<tt>/usr/local/include</tt>&rsquo;, but write it as
&lsquo;<tt>$(prefix)/include</tt>&rsquo;.
(If you are using Autoconf, write it as &lsquo;<samp>@includedir@</samp>&rsquo;.)
</p>
<p>Most compilers other than GCC do not look for header files in directory
&lsquo;<tt>/usr/local/include</tt>&rsquo;.  So installing the header files this way is
only useful with GCC.  Sometimes this is not a problem because some
libraries are only really intended to work with GCC.  But some libraries
are intended to work with other compilers.  They should install their
header files in two places, one specified by <code>includedir</code> and one
specified by <code>oldincludedir</code>.
</p>
</dd>
<dt> &lsquo;<samp>oldincludedir</samp>&rsquo;</dt>
<dd><p>The directory for installing &lsquo;<samp>#include</samp>&rsquo; header files for use with
compilers other than GCC.  This should normally be &lsquo;<tt>/usr/include</tt>&rsquo;.
(If you are using Autoconf, you can write it as &lsquo;<samp>@oldincludedir@</samp>&rsquo;.)
</p>
<p>The Makefile commands should check whether the value of
<code>oldincludedir</code> is empty.  If it is, they should not try to use
it; they should cancel the second installation of the header files.
</p>
<p>A package should not replace an existing header in this directory unless
the header came from the same package.  Thus, if your Foo package
provides a header file &lsquo;<tt>foo.h</tt>&rsquo;, then it should install the header
file in the <code>oldincludedir</code> directory if either (1) there is no
&lsquo;<tt>foo.h</tt>&rsquo; there or (2) the &lsquo;<tt>foo.h</tt>&rsquo; that exists came from the Foo
package.
</p>
<p>To tell whether &lsquo;<tt>foo.h</tt>&rsquo; came from the Foo package, put a magic
string in the file&mdash;part of a comment&mdash;and <code>grep</code> for that string.
</p>
</dd>
<dt> &lsquo;<samp>docdir</samp>&rsquo;</dt>
<dd><p>The directory for installing documentation files (other than Info) for
this package.  By default, it should be
&lsquo;<tt>/usr/local/share/doc/<var>yourpkg</var></tt>&rsquo;, but it should be written as
&lsquo;<tt>$(datarootdir)/doc/<var>yourpkg</var></tt>&rsquo;.  (If you are using Autoconf,
write it as &lsquo;<samp>@docdir@</samp>&rsquo;.)  The <var>yourpkg</var> subdirectory, which
may include a version number, prevents collisions among files with
common names, such as &lsquo;<tt>README</tt>&rsquo;.
</p>
</dd>
<dt> &lsquo;<samp>infodir</samp>&rsquo;</dt>
<dd><p>The directory for installing the Info files for this package.  By
default, it should be &lsquo;<tt>/usr/local/share/info</tt>&rsquo;, but it should be
written as &lsquo;<tt>$(datarootdir)/info</tt>&rsquo;.  (If you are using Autoconf,
write it as &lsquo;<samp>@infodir@</samp>&rsquo;.)  <code>infodir</code> is separate from
<code>docdir</code> for compatibility with existing practice.
</p>
</dd>
<dt> &lsquo;<samp>htmldir</samp>&rsquo;</dt>
<dt> &lsquo;<samp>dvidir</samp>&rsquo;</dt>
<dt> &lsquo;<samp>pdfdir</samp>&rsquo;</dt>
<dt> &lsquo;<samp>psdir</samp>&rsquo;</dt>
<dd><p>Directories for installing documentation files in the particular
format.  They should all be set to <code>$(docdir)</code> by default.  (If
you are using Autoconf, write them as &lsquo;<samp>@htmldir@</samp>&rsquo;,
&lsquo;<samp>@dvidir@</samp>&rsquo;, etc.)  Packages which supply several translations
of their documentation should install them in
&lsquo;<samp>$(htmldir)/</samp>&rsquo;<var>ll</var>, &lsquo;<samp>$(pdfdir)/</samp>&rsquo;<var>ll</var>, etc. where
<var>ll</var> is a locale abbreviation such as &lsquo;<samp>en</samp>&rsquo; or &lsquo;<samp>pt_BR</samp>&rsquo;.
</p>
</dd>
<dt> &lsquo;<samp>libdir</samp>&rsquo;</dt>
<dd><p>The directory for object files and libraries of object code.  Do not
install executables here, they probably ought to go in &lsquo;<tt>$(libexecdir)</tt>&rsquo;
instead.  The value of <code>libdir</code> should normally be
&lsquo;<tt>/usr/local/lib</tt>&rsquo;, but write it as &lsquo;<tt>$(exec_prefix)/lib</tt>&rsquo;.
(If you are using Autoconf, write it as &lsquo;<samp>@libdir@</samp>&rsquo;.)
</p>
</dd>
<dt> &lsquo;<samp>lispdir</samp>&rsquo;</dt>
<dd><p>The directory for installing any Emacs Lisp files in this package.  By
default, it should be &lsquo;<tt>/usr/local/share/emacs/site-lisp</tt>&rsquo;, but it
should be written as &lsquo;<tt>$(datarootdir)/emacs/site-lisp</tt>&rsquo;.
</p>
<p>If you are using Autoconf, write the default as &lsquo;<samp>@lispdir@</samp>&rsquo;.
In order to make &lsquo;<samp>@lispdir@</samp>&rsquo; work, you need the following lines
in your &lsquo;<tt>configure.in</tt>&rsquo; file:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">lispdir='${datarootdir}/emacs/site-lisp'
AC_SUBST(lispdir)
</pre></td></tr></table>

</dd>
<dt> &lsquo;<samp>localedir</samp>&rsquo;</dt>
<dd><p>The directory for installing locale-specific message catalogs for this
package.  By default, it should be &lsquo;<tt>/usr/local/share/locale</tt>&rsquo;, but
it should be written as &lsquo;<tt>$(datarootdir)/locale</tt>&rsquo;.  (If you are
using Autoconf, write it as &lsquo;<samp>@localedir@</samp>&rsquo;.)  This directory
usually has a subdirectory per locale.
</p></dd>
</dl>

<p>Unix-style man pages are installed in one of the following:
</p>
<dl compact="compact">
<dt> &lsquo;<samp>mandir</samp>&rsquo;</dt>
<dd><p>The top-level directory for installing the man pages (if any) for this
package.  It will normally be &lsquo;<tt>/usr/local/share/man</tt>&rsquo;, but you
should write it as &lsquo;<tt>$(datarootdir)/man</tt>&rsquo;.  (If you are using
Autoconf, write it as &lsquo;<samp>@mandir@</samp>&rsquo;.)
</p>
</dd>
<dt> &lsquo;<samp>man1dir</samp>&rsquo;</dt>
<dd><p>The directory for installing section 1 man pages.  Write it as
&lsquo;<tt>$(mandir)/man1</tt>&rsquo;.
</p></dd>
<dt> &lsquo;<samp>man2dir</samp>&rsquo;</dt>
<dd><p>The directory for installing section 2 man pages.  Write it as
&lsquo;<tt>$(mandir)/man2</tt>&rsquo;
</p></dd>
<dt> &lsquo;<samp>&hellip;</samp>&rsquo;</dt>
<dd>
<p><strong>Don&rsquo;t make the primary documentation for any GNU software be a
man page.  Write a manual in Texinfo instead.  Man pages are just for
the sake of people running GNU software on Unix, which is a secondary
application only.</strong>
</p>
</dd>
<dt> &lsquo;<samp>manext</samp>&rsquo;</dt>
<dd><p>The file name extension for the installed man page.  This should contain
a period followed by the appropriate digit; it should normally be &lsquo;<samp>.1</samp>&rsquo;.
</p>
</dd>
<dt> &lsquo;<samp>man1ext</samp>&rsquo;</dt>
<dd><p>The file name extension for installed section 1 man pages.
</p></dd>
<dt> &lsquo;<samp>man2ext</samp>&rsquo;</dt>
<dd><p>The file name extension for installed section 2 man pages.
</p></dd>
<dt> &lsquo;<samp>&hellip;</samp>&rsquo;</dt>
<dd><p>Use these names instead of &lsquo;<samp>manext</samp>&rsquo; if the package needs to install man
pages in more than one section of the manual.
</p></dd>
</dl>

<p>And finally, you should set the following variable:
</p>
<dl compact="compact">
<dt> &lsquo;<samp>srcdir</samp>&rsquo;</dt>
<dd><p>The directory for the sources being compiled.  The value of this
variable is normally inserted by the <code>configure</code> shell script.
(If you are using Autoconf, use &lsquo;<samp>srcdir = @srcdir@</samp>&rsquo;.)
</p></dd>
</dl>

<p>For example:
</p>
<table><tr><td>&nbsp;</td><td><pre class="smallexample"># Common prefix for installation directories.
# NOTE: This directory must exist when you start the install.
prefix = /usr/local
datarootdir = $(prefix)/share
datadir = $(datarootdir)
exec_prefix = $(prefix)
# Where to put the executable for the command `gcc'.
bindir = $(exec_prefix)/bin
# Where to put the directories used by the compiler.
libexecdir = $(exec_prefix)/libexec
# Where to put the Info files.
infodir = $(datarootdir)/info
</pre></td></tr></table>

<p>If your program installs a large number of files into one of the
standard user-specified directories, it might be useful to group them
into a subdirectory particular to that program.  If you do this, you
should write the <code>install</code> rule to create these subdirectories.
</p>
<p>Do not expect the user to include the subdirectory name in the value of
any of the variables listed above.  The idea of having a uniform set of
variable names for installation directories is to enable the user to
specify the exact same values for several different GNU packages.  In
order for this to be useful, all the packages must be designed so that
they will work sensibly when the user does so.
</p>
<p>At times, not all of these variables may be implemented in the current
release of Autoconf and/or Automake; but as of Autoconf&nbsp;2.60, we
believe all of them are.  When any are missing, the descriptions here
serve as specifications for what Autoconf will implement.  As a
programmer, you can either use a development version of Autoconf or
avoid using these variables until a stable release is made which
supports them.
</p>

<hr size="6">
<a name="Standard-Targets"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Directory-Variables" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Install-Command-Categories" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Managing-Releases" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Makefile-Conventions" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#References" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Standard-Targets-for-Users"></a>
<h3 class="subsection">7.2.6 Standard Targets for Users</h3>

<p>All GNU programs should have the following targets in their Makefiles:
</p>
<dl compact="compact">
<dt> &lsquo;<samp>all</samp>&rsquo;</dt>
<dd><p>Compile the entire program.  This should be the default target.  This
target need not rebuild any documentation files; Info files should
normally be included in the distribution, and DVI (and other
documentation format) files should be made only when explicitly asked
for.
</p>
<p>By default, the Make rules should compile and link with &lsquo;<samp>-g</samp>&rsquo;, so
that executable programs have debugging symbols.  Otherwise, you are
essentially helpless in the face of a crash, and it is often far from
easy to reproduce with a fresh build.
</p>
</dd>
<dt> &lsquo;<samp>install</samp>&rsquo;</dt>
<dd><p>Compile the program and copy the executables, libraries, and so on to
the file names where they should reside for actual use.  If there is a
simple test to verify that a program is properly installed, this target
should run that test.
</p>
<p>Do not strip executables when installing them.  This helps eventual
debugging that may be needed later, and nowadays disk space is cheap
and dynamic loaders typically ensure debug sections are not loaded during
normal execution.  Users that need stripped binaries may invoke the
<code>install-strip</code> target to do that.
</p>
<p>If possible, write the <code>install</code> target rule so that it does not
modify anything in the directory where the program was built, provided
&lsquo;<samp>make all</samp>&rsquo; has just been done.  This is convenient for building the
program under one user name and installing it under another.
</p>
<p>The commands should create all the directories in which files are to be
installed, if they don&rsquo;t already exist.  This includes the directories
specified as the values of the variables <code>prefix</code> and
<code>exec_prefix</code>, as well as all subdirectories that are needed.
One way to do this is by means of an <code>installdirs</code> target
as described below.
</p>
<p>Use &lsquo;<samp>-</samp>&rsquo; before any command for installing a man page, so that
<code>make</code> will ignore any errors.  This is in case there are systems
that don&rsquo;t have the Unix man page documentation system installed.
</p>
<p>The way to install Info files is to copy them into &lsquo;<tt>$(infodir)</tt>&rsquo;
with <code>$(INSTALL_DATA)</code> (see section <a href="#Command-Variables">Variables for Specifying Commands</a>), and then run
the <code>install-info</code> program if it is present.  <code>install-info</code>
is a program that edits the Info &lsquo;<tt>dir</tt>&rsquo; file to add or update the
menu entry for the given Info file; it is part of the Texinfo package.
</p>
<p>Here is a sample rule to install an Info file that also tries to
handle some additional situations, such as <code>install-info</code> not
being present.
</p>
<table><tr><td>&nbsp;</td><td><pre class="smallexample">do-install-info: foo.info installdirs
        $(NORMAL_INSTALL)
# Prefer an info file in . to one in srcdir.
        if test -f foo.info; then d=.; \
         else d=&quot;$(srcdir)&quot;; fi; \
        $(INSTALL_DATA) $$d/foo.info \
          &quot;$(DESTDIR)$(infodir)/foo.info&quot;
# Run install-info only if it exists.
# Use `if' instead of just prepending `-' to the
# line so we notice real errors from install-info.
# Use `$(SHELL) -c' because some shells do not
# fail gracefully when there is an unknown command.
        $(POST_INSTALL)
        if $(SHELL) -c 'install-info --version' \
           &gt;/dev/null 2&gt;&amp;1; then \
          install-info --dir-file=&quot;$(DESTDIR)$(infodir)/dir&quot; \
                       &quot;$(DESTDIR)$(infodir)/foo.info&quot;; \
        else true; fi
</pre></td></tr></table>

<p>When writing the <code>install</code> target, you must classify all the
commands into three categories: normal ones, <em>pre-installation</em>
commands and <em>post-installation</em> commands.  See section <a href="#Install-Command-Categories">Install Command Categories</a>.
</p>
</dd>
<dt> &lsquo;<samp>install-html</samp>&rsquo;</dt>
<dt> &lsquo;<samp>install-dvi</samp>&rsquo;</dt>
<dt> &lsquo;<samp>install-pdf</samp>&rsquo;</dt>
<dt> &lsquo;<samp>install-ps</samp>&rsquo;</dt>
<dd><p>These targets install documentation in formats other than Info;
they&rsquo;re intended to be called explicitly by the person installing the
package, if that format is desired.  GNU prefers Info files, so these
must be installed by the <code>install</code> target.
</p>
<p>When you have many documentation files to install, we recommend that
you avoid collisions and clutter by arranging for these targets to
install in subdirectories of the appropriate installation directory,
such as <code>htmldir</code>.  As one example, if your package has multiple
manuals, and you wish to install HTML documentation with many files
(such as the &ldquo;split&rdquo; mode output by <code>makeinfo --html</code>), you&rsquo;ll
certainly want to use subdirectories, or two nodes with the same name
in different manuals will overwrite each other.
</p>
<p>Please make these <code>install-<var>format</var></code> targets invoke the
commands for the <var>format</var> target, for example, by making
<var>format</var> a dependency.
</p>
</dd>
<dt> &lsquo;<samp>uninstall</samp>&rsquo;</dt>
<dd><p>Delete all the installed files&mdash;the copies that the &lsquo;<samp>install</samp>&rsquo;
and &lsquo;<samp>install-*</samp>&rsquo; targets create.
</p>
<p>This rule should not modify the directories where compilation is done,
only the directories where files are installed.
</p>
<p>The uninstallation commands are divided into three categories, just like
the installation commands.  See section <a href="#Install-Command-Categories">Install Command Categories</a>.
</p>
</dd>
<dt> &lsquo;<samp>install-strip</samp>&rsquo;</dt>
<dd><p>Like <code>install</code>, but strip the executable files while installing
them.  In simple cases, this target can use the <code>install</code> target in
a simple way:
</p>
<table><tr><td>&nbsp;</td><td><pre class="smallexample">install-strip:
        $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' \
                install
</pre></td></tr></table>

<p>But if the package installs scripts as well as real executables, the
<code>install-strip</code> target can&rsquo;t just refer to the <code>install</code>
target; it has to strip the executables but not the scripts.
</p>
<p><code>install-strip</code> should not strip the executables in the build
directory which are being copied for installation.  It should only strip
the copies that are installed.
</p>
<p>Normally we do not recommend stripping an executable unless you are sure
the program has no bugs.  However, it can be reasonable to install a
stripped executable for actual execution while saving the unstripped
executable elsewhere in case there is a bug.
</p>
</dd>
<dt> &lsquo;<samp>clean</samp>&rsquo;</dt>
<dd><p>Delete all files in the current directory that are normally created by
building the program.  Also delete files in other directories if they
are created by this makefile.  However, don&rsquo;t delete the files that
record the configuration.  Also preserve files that could be made by
building, but normally aren&rsquo;t because the distribution comes with
them.  There is no need to delete parent directories that were created
with &lsquo;<samp>mkdir -p</samp>&rsquo;, since they could have existed anyway.
</p>
<p>Delete &lsquo;<tt>.dvi</tt>&rsquo; files here if they are not part of the distribution.
</p>
</dd>
<dt> &lsquo;<samp>distclean</samp>&rsquo;</dt>
<dd><p>Delete all files in the current directory (or created by this
makefile) that are created by configuring or building the program.  If
you have unpacked the source and built the program without creating
any other files, &lsquo;<samp>make distclean</samp>&rsquo; should leave only the files
that were in the distribution.  However, there is no need to delete
parent directories that were created with &lsquo;<samp>mkdir -p</samp>&rsquo;, since they
could have existed anyway.
</p>
</dd>
<dt> &lsquo;<samp>mostlyclean</samp>&rsquo;</dt>
<dd><p>Like &lsquo;<samp>clean</samp>&rsquo;, but may refrain from deleting a few files that people
normally don&rsquo;t want to recompile.  For example, the &lsquo;<samp>mostlyclean</samp>&rsquo;
target for GCC does not delete &lsquo;<tt>libgcc.a</tt>&rsquo;, because recompiling it
is rarely necessary and takes a lot of time.
</p>
</dd>
<dt> &lsquo;<samp>maintainer-clean</samp>&rsquo;</dt>
<dd><p>Delete almost everything that can be reconstructed with this Makefile.
This typically includes everything deleted by <code>distclean</code>, plus
more: C source files produced by Bison, tags tables, Info files, and
so on.
</p>
<p>The reason we say &ldquo;almost everything&rdquo; is that running the command
&lsquo;<samp>make maintainer-clean</samp>&rsquo; should not delete &lsquo;<tt>configure</tt>&rsquo; even
if &lsquo;<tt>configure</tt>&rsquo; can be remade using a rule in the Makefile.  More
generally, &lsquo;<samp>make maintainer-clean</samp>&rsquo; should not delete anything
that needs to exist in order to run &lsquo;<tt>configure</tt>&rsquo; and then begin to
build the program.  Also, there is no need to delete parent
directories that were created with &lsquo;<samp>mkdir -p</samp>&rsquo;, since they could
have existed anyway.  These are the only exceptions;
<code>maintainer-clean</code> should delete everything else that can be
rebuilt.
</p>
<p>The &lsquo;<samp>maintainer-clean</samp>&rsquo; target is intended to be used by a maintainer of
the package, not by ordinary users.  You may need special tools to
reconstruct some of the files that &lsquo;<samp>make maintainer-clean</samp>&rsquo; deletes.
Since these files are normally included in the distribution, we don&rsquo;t
take care to make them easy to reconstruct.  If you find you need to
unpack the full distribution again, don&rsquo;t blame us.
</p>
<p>To help make users aware of this, the commands for the special
<code>maintainer-clean</code> target should start with these two:
</p>
<table><tr><td>&nbsp;</td><td><pre class="smallexample">@echo 'This command is intended for maintainers to use; it'
@echo 'deletes files that may need special tools to rebuild.'
</pre></td></tr></table>

</dd>
<dt> &lsquo;<samp>TAGS</samp>&rsquo;</dt>
<dd><p>Update a tags table for this program.
</p>
</dd>
<dt> &lsquo;<samp>info</samp>&rsquo;</dt>
<dd><p>Generate any Info files needed.  The best way to write the rules is as
follows:
</p>
<table><tr><td>&nbsp;</td><td><pre class="smallexample">info: foo.info

foo.info: foo.texi chap1.texi chap2.texi
        $(MAKEINFO) $(srcdir)/foo.texi
</pre></td></tr></table>

<p>You must define the variable <code>MAKEINFO</code> in the Makefile.  It should
run the <code>makeinfo</code> program, which is part of the Texinfo
distribution.
</p>
<p>Normally a GNU distribution comes with Info files, and that means the
Info files are present in the source directory.  Therefore, the Make
rule for an info file should update it in the source directory.  When
users build the package, ordinarily Make will not update the Info files
because they will already be up to date.
</p>
</dd>
<dt> &lsquo;<samp>dvi</samp>&rsquo;</dt>
<dt> &lsquo;<samp>html</samp>&rsquo;</dt>
<dt> &lsquo;<samp>pdf</samp>&rsquo;</dt>
<dt> &lsquo;<samp>ps</samp>&rsquo;</dt>
<dd><p>Generate documentation files in the given format.  These targets
should always exist, but any or all can be a no-op if the given output
format cannot be generated.  These targets should not be dependencies
of the <code>all</code> target; the user must manually invoke them.
</p>
<p>Here&rsquo;s an example rule for generating DVI files from Texinfo:
</p>
<table><tr><td>&nbsp;</td><td><pre class="smallexample">dvi: foo.dvi

foo.dvi: foo.texi chap1.texi chap2.texi
        $(TEXI2DVI) $(srcdir)/foo.texi
</pre></td></tr></table>

<p>You must define the variable <code>TEXI2DVI</code> in the Makefile.  It
should run the program <code>texi2dvi</code>, which is part of the Texinfo
distribution.  (<code>texi2dvi</code> uses TeX to do the real work of
formatting. TeX is not distributed with Texinfo.)  Alternatively,
write only the dependencies, and allow GNU <code>make</code> to provide the
command.
</p>
<p>Here&rsquo;s another example, this one for generating HTML from Texinfo:
</p>
<table><tr><td>&nbsp;</td><td><pre class="smallexample">html: foo.html

foo.html: foo.texi chap1.texi chap2.texi
        $(TEXI2HTML) $(srcdir)/foo.texi
</pre></td></tr></table>

<p>Again, you would define the variable <code>TEXI2HTML</code> in the Makefile;
for example, it might run <code>makeinfo --no-split --html</code>
(<code>makeinfo</code> is part of the Texinfo distribution).
</p>
</dd>
<dt> &lsquo;<samp>dist</samp>&rsquo;</dt>
<dd><p>Create a distribution tar file for this program.  The tar file should be
set up so that the file names in the tar file start with a subdirectory
name which is the name of the package it is a distribution for.  This
name can include the version number.
</p>
<p>For example, the distribution tar file of GCC version 1.40 unpacks into
a subdirectory named &lsquo;<tt>gcc-1.40</tt>&rsquo;.
</p>
<p>The easiest way to do this is to create a subdirectory appropriately
named, use <code>ln</code> or <code>cp</code> to install the proper files in it, and
then <code>tar</code> that subdirectory.
</p>
<p>Compress the tar file with <code>gzip</code>.  For example, the actual
distribution file for GCC version 1.40 is called &lsquo;<tt>gcc-1.40.tar.gz</tt>&rsquo;.
It is ok to support other free compression formats as well.
</p>
<p>The <code>dist</code> target should explicitly depend on all non-source files
that are in the distribution, to make sure they are up to date in the
distribution.
See section <a href="#Releases">Making Releases</a>.
</p>
</dd>
<dt> &lsquo;<samp>check</samp>&rsquo;</dt>
<dd><p>Perform self-tests (if any).  The user must build the program before
running the tests, but need not install the program; you should write
the self-tests so that they work when the program is built but not
installed.
</p></dd>
</dl>

<p>The following targets are suggested as conventional names, for programs
in which they are useful.
</p>
<dl compact="compact">
<dt> <code>installcheck</code></dt>
<dd><p>Perform installation tests (if any).  The user must build and install
the program before running the tests.  You should not assume that
&lsquo;<tt>$(bindir)</tt>&rsquo; is in the search path.
</p>
</dd>
<dt> <code>installdirs</code></dt>
<dd><p>It&rsquo;s useful to add a target named &lsquo;<samp>installdirs</samp>&rsquo; to create the
directories where files are installed, and their parent directories.
There is a script called &lsquo;<tt>mkinstalldirs</tt>&rsquo; which is convenient for
this; you can find it in the Gnulib package.
You can use a rule like this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="smallexample"># Make sure all installation directories (e.g. $(bindir))
# actually exist by making them if necessary.
installdirs: mkinstalldirs
        $(srcdir)/mkinstalldirs $(bindir) $(datadir) \
                                $(libdir) $(infodir) \
                                $(mandir)
</pre></td></tr></table>

<p>or, if you wish to support <code>DESTDIR</code> (strongly encouraged),
</p>
<table><tr><td>&nbsp;</td><td><pre class="smallexample"># Make sure all installation directories (e.g. $(bindir))
# actually exist by making them if necessary.
installdirs: mkinstalldirs
        $(srcdir)/mkinstalldirs \
            $(DESTDIR)$(bindir) $(DESTDIR)$(datadir) \
            $(DESTDIR)$(libdir) $(DESTDIR)$(infodir) \
            $(DESTDIR)$(mandir)
</pre></td></tr></table>

<p>This rule should not modify the directories where compilation is done.
It should do nothing but create installation directories.
</p></dd>
</dl>

<hr size="6">
<a name="Install-Command-Categories"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Standard-Targets" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Releases" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Managing-Releases" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Makefile-Conventions" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#References" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Install-Command-Categories-1"></a>
<h3 class="subsection">7.2.7 Install Command Categories</h3>

<a name="index-pre_002dinstallation-commands"></a>
<a name="index-post_002dinstallation-commands"></a>
<p>When writing the <code>install</code> target, you must classify all the
commands into three categories: normal ones, <em>pre-installation</em>
commands and <em>post-installation</em> commands.
</p>
<p>Normal commands move files into their proper places, and set their
modes.  They may not alter any files except the ones that come entirely
from the package they belong to.
</p>
<p>Pre-installation and post-installation commands may alter other files;
in particular, they can edit global configuration files or data bases.
</p>
<p>Pre-installation commands are typically executed before the normal
commands, and post-installation commands are typically run after the
normal commands.
</p>
<p>The most common use for a post-installation command is to run
<code>install-info</code>.  This cannot be done with a normal command, since
it alters a file (the Info directory) which does not come entirely and
solely from the package being installed.  It is a post-installation
command because it needs to be done after the normal command which
installs the package&rsquo;s Info files.
</p>
<p>Most programs don&rsquo;t need any pre-installation commands, but we have the
feature just in case it is needed.
</p>
<p>To classify the commands in the <code>install</code> rule into these three
categories, insert <em>category lines</em> among them.  A category line
specifies the category for the commands that follow.
</p>
<p>A category line consists of a tab and a reference to a special Make
variable, plus an optional comment at the end.  There are three
variables you can use, one for each category; the variable name
specifies the category.  Category lines are no-ops in ordinary execution
because these three Make variables are normally undefined (and you
<em>should not</em> define them in the makefile).
</p>
<p>Here are the three possible category lines, each with a comment that
explains what it means:
</p>
<table><tr><td>&nbsp;</td><td><pre class="smallexample">        $(PRE_INSTALL)     # <span class="roman">Pre-install commands follow.</span>
        $(POST_INSTALL)    # <span class="roman">Post-install commands follow.</span>
        $(NORMAL_INSTALL)  # <span class="roman">Normal commands follow.</span>
</pre></td></tr></table>

<p>If you don&rsquo;t use a category line at the beginning of the <code>install</code>
rule, all the commands are classified as normal until the first category
line.  If you don&rsquo;t use any category lines, all the commands are
classified as normal.
</p>
<p>These are the category lines for <code>uninstall</code>:
</p>
<table><tr><td>&nbsp;</td><td><pre class="smallexample">        $(PRE_UNINSTALL)     # <span class="roman">Pre-uninstall commands follow.</span>
        $(POST_UNINSTALL)    # <span class="roman">Post-uninstall commands follow.</span>
        $(NORMAL_UNINSTALL)  # <span class="roman">Normal commands follow.</span>
</pre></td></tr></table>

<p>Typically, a pre-uninstall command would be used for deleting entries
from the Info directory.
</p>
<p>If the <code>install</code> or <code>uninstall</code> target has any dependencies
which act as subroutines of installation, then you should start
<em>each</em> dependency&rsquo;s commands with a category line, and start the
main target&rsquo;s commands with a category line also.  This way, you can
ensure that each command is placed in the right category regardless of
which of the dependencies actually run.
</p>
<p>Pre-installation and post-installation commands should not run any
programs except for these:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">[ basename bash cat chgrp chmod chown cmp cp dd diff echo
egrep expand expr false fgrep find getopt grep gunzip gzip
hostname install install-info kill ldconfig ln ls md5sum
mkdir mkfifo mknod mv printenv pwd rm rmdir sed sort tee
test touch true uname xargs yes
</pre></td></tr></table>

<a name="index-binary-packages"></a>
<p>The reason for distinguishing the commands in this way is for the sake
of making binary packages.  Typically a binary package contains all the
executables and other files that need to be installed, and has its own
method of installing them&mdash;so it does not need to run the normal
installation commands.  But installing the binary package does need to
execute the pre-installation and post-installation commands.
</p>
<p>Programs to build binary packages work by extracting the
pre-installation and post-installation commands.  Here is one way of
extracting the pre-installation commands (the &lsquo;<samp>-s</samp>&rsquo; option to
<code>make</code> is needed to silence messages about entering
subdirectories):
</p>
<table><tr><td>&nbsp;</td><td><pre class="smallexample">make -s -n install -o all \
      PRE_INSTALL=pre-install \
      POST_INSTALL=post-install \
      NORMAL_INSTALL=normal-install \
  | gawk -f pre-install.awk
</pre></td></tr></table>

<p>where the file &lsquo;<tt>pre-install.awk</tt>&rsquo; could contain this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="smallexample">$0 ~ /^(normal-install|post-install)[ \t]*$/ {on = 0}
on {print $0}
$0 ~ /^pre-install[ \t]*$/ {on = 1}
</pre></td></tr></table>

<hr size="6">
<a name="Releases"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Install-Command-Categories" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#References" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Managing-Releases" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Managing-Releases" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#References" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Making-Releases"></a>
<h2 class="section">7.3 Making Releases</h2>
<a name="index-packaging"></a>

<p>You should identify each release with a pair of version numbers, a
major version and a minor.  We have no objection to using more than
two numbers, but it is very unlikely that you really need them.
</p>
<p>Package the distribution of <code>Foo version 69.96</code> up in a gzipped tar
file with the name &lsquo;<tt>foo-69.96.tar.gz</tt>&rsquo;.  It should unpack into a
subdirectory named &lsquo;<tt>foo-69.96</tt>&rsquo;.
</p>
<p>Building and installing the program should never modify any of the files
contained in the distribution.  This means that all the files that form
part of the program in any way must be classified into <em>source
files</em> and <em>non-source files</em>.  Source files are written by humans
and never changed automatically; non-source files are produced from
source files by programs under the control of the Makefile.
</p>
<a name="index-README-file"></a>
<p>The distribution should contain a file named &lsquo;<tt>README</tt>&rsquo; which gives
the name of the package, and a general description of what it does.  It
is also good to explain the purpose of each of the first-level
subdirectories in the package, if there are any.  The &lsquo;<tt>README</tt>&rsquo; file
should either state the version number of the package, or refer to where
in the package it can be found.
</p>
<p>The &lsquo;<tt>README</tt>&rsquo; file should refer to the file &lsquo;<tt>INSTALL</tt>&rsquo;, which
should contain an explanation of the installation procedure.
</p>
<p>The &lsquo;<tt>README</tt>&rsquo; file should also refer to the file which contains the
copying conditions.  The GNU GPL, if used, should be in a file called
&lsquo;<tt>COPYING</tt>&rsquo;.  If the GNU LGPL is used, it should be in a file called
&lsquo;<tt>COPYING.LESSER</tt>&rsquo;.
</p>
<p>Naturally, all the source files must be in the distribution.  It is okay
to include non-source files in the distribution, provided they are
up-to-date and machine-independent, so that building the distribution
normally will never modify them.  We commonly include non-source files
produced by Bison, <code>lex</code>, TeX, and <code>makeinfo</code>; this helps avoid
unnecessary dependencies between our distributions, so that users can
install whichever packages they want to install.
</p>
<p>Non-source files that might actually be modified by building and
installing the program should <strong>never</strong> be included in the
distribution.  So if you do distribute non-source files, always make
sure they are up to date when you make a new distribution.
</p>
<p>Make sure that all the files in the distribution are world-readable, and
that directories are world-readable and world-searchable (octal mode 755).
We used to recommend that all directories in the distribution also be
world-writable (octal mode 777), because ancient versions of <code>tar</code>
would otherwise not cope when extracting the archive as an unprivileged
user.  That can easily lead to security issues when creating the archive,
however, so now we recommend against that.
</p>
<p>Don&rsquo;t include any symbolic links in the distribution itself.  If the tar
file contains symbolic links, then people cannot even unpack it on
systems that don&rsquo;t support symbolic links.  Also, don&rsquo;t use multiple
names for one file in different directories, because certain file
systems cannot handle this and that prevents unpacking the
distribution.
</p>
<p>Try to make sure that all the file names will be unique on MS-DOS.  A
name on MS-DOS consists of up to 8 characters, optionally followed by a
period and up to three characters.  MS-DOS will truncate extra
characters both before and after the period.  Thus,
&lsquo;<tt>foobarhacker.c</tt>&rsquo; and &lsquo;<tt>foobarhacker.o</tt>&rsquo; are not ambiguous; they
are truncated to &lsquo;<tt>foobarha.c</tt>&rsquo; and &lsquo;<tt>foobarha.o</tt>&rsquo;, which are
distinct.
</p>
<a name="index-texinfo_002etex_002c-in-a-distribution"></a>
<p>Include in your distribution a copy of the &lsquo;<tt>texinfo.tex</tt>&rsquo; you used
to test print any &lsquo;<tt>*.texinfo</tt>&rsquo; or &lsquo;<tt>*.texi</tt>&rsquo; files.
</p>
<p>Likewise, if your program uses small GNU software packages like regex,
getopt, obstack, or termcap, include them in the distribution file.
Leaving them out would make the distribution file a little smaller at
the expense of possible inconvenience to a user who doesn&rsquo;t know what
other files to get.
</p>
<hr size="6">
<a name="References"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Releases" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#GNU-Free-Documentation-License" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Managing-Releases" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#GNU-Free-Documentation-License" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="References-to-Non_002dFree-Software-and-Documentation"></a>
<h1 class="chapter">8. References to Non-Free Software and Documentation</h1>
<a name="index-references-to-non_002dfree-material"></a>

<p>A GNU program should not recommend, promote, or grant legitimacy to
the use of any non-free program.  Proprietary software is a social and
ethical problem, and our aim is to put an end to that problem.  We
can&rsquo;t stop some people from writing proprietary programs, or stop
other people from using them, but we can and should refuse to
advertise them to new potential customers, or to give the public the
idea that their existence is ethical.
</p>
<p>The GNU definition of free software is found on the GNU web site at
<a href="http://www.gnu.org/philosophy/free-sw.html">http://www.gnu.org/philosophy/free-sw.html</a>, and the definition
of free documentation is found at
<a href="http://www.gnu.org/philosophy/free-doc.html">http://www.gnu.org/philosophy/free-doc.html</a>.  The terms &ldquo;free&rdquo;
and &ldquo;non-free&rdquo;, used in this document, refer to those definitions.
</p>
<p>A list of important licenses and whether they qualify as free is in
<a href="http://www.gnu.org/licenses/license-list.html">http://www.gnu.org/licenses/license-list.html</a>.  If it is not
clear whether a license qualifies as free, please ask the GNU Project
by writing to <a href="mailto:licensing@gnu.org">licensing@gnu.org</a>.  We will answer, and if the
license is an important one, we will add it to the list.
</p>
<p>When a non-free program or system is well known, you can mention it in
passing&mdash;that is harmless, since users who might want to use it
probably already know about it.  For instance, it is fine to explain
how to build your package on top of some widely used non-free
operating system, or how to use it together with some widely used
non-free program.
</p>
<p>However, you should give only the necessary information to help those
who already use the non-free program to use your program with
it&mdash;don&rsquo;t give, or refer to, any further information about the
proprietary program, and don&rsquo;t imply that the proprietary program
enhances your program, or that its existence is in any way a good
thing.  The goal should be that people already using the proprietary
program will get the advice they need about how to use your free
program with it, while people who don&rsquo;t already use the proprietary
program will not see anything likely to lead them to take an interest
in it.
</p>
<p>If a non-free program or system is obscure in your program&rsquo;s domain,
your program should not mention or support it at all, since doing so
would tend to popularize the non-free program more than it popularizes
your program.  (You cannot hope to find many additional users for your
program among the users of Foobar, if the existence of Foobar is not
generally known among people who might want to use your program.)
</p>
<p>Sometimes a program is free software in itself but depends on a
non-free platform in order to run.  For instance, many Java programs
depend on some non-free Java libraries.  To recommend or promote such
a program is to promote the other programs it needs.  This is why we
are careful about listing Java programs in the Free Software
Directory: we don&rsquo;t want to promote the non-free Java libraries.
</p>
<p>We hope this particular problem with Java will be gone by and by, as
we replace the remaining non-free standard Java libraries with free
software, but the general principle will remain the same: don&rsquo;t
recommend, promote or legitimize programs that depend on non-free
software to run.
</p>
<p>Some free programs strongly encourage the use of non-free software.  A
typical example is <code>mplayer</code>.  It is free software in itself,
and the free code can handle some kinds of files.  However,
<code>mplayer</code> recommends use of non-free codecs for other kinds of
files, and users that install <code>mplayer</code> are very likely to
install those codecs along with it.  To recommend <code>mplayer</code>
is, in effect, to promote use of the non-free codecs.
</p>
<p>Thus, you should not recommend programs that strongly encourage the
use of non-free software.  This is why we do not list
<code>mplayer</code> in the Free Software Directory.
</p>
<p>A GNU package should not refer the user to any non-free documentation
for free software.  Free documentation that can be included in free
operating systems is essential for completing the GNU system, or any
free operating system, so encouraging it is a priority; to recommend
use of documentation that we are not allowed to include undermines the
impetus for the community to produce documentation that we can
include.  So GNU packages should never recommend non-free
documentation.
</p>
<p>By contrast, it is ok to refer to journal articles and textbooks in
the comments of a program for explanation of how it functions, even
though they are non-free.  This is because we don&rsquo;t include such
things in the GNU system even if they are free&mdash;they are outside the
scope of what a software distribution needs to include.
</p>
<p>Referring to a web site that describes or recommends a non-free
program is promoting that program, so please do not make links (or
mention by name) web sites that contain such material.  This policy is
relevant particularly for the web pages for a GNU package.
</p>
<p>Following links from nearly any web site can lead eventually to
non-free software; this is inherent in the nature of the web.  So it
makes no sense to criticize a site for having such links.  As long as
the site does not itself recommend a non-free program, there is no
need to consider the question of the sites that it links to for other
reasons.
</p>
<p>Thus, for example, you should not refer to AT&amp;T&rsquo;s web site if that
recommends AT&amp;T&rsquo;s non-free software packages; you should not refer to
a site that links to AT&amp;T&rsquo;s site presenting it as a place to get some
non-free program, because that link recommends and legitimizes the
non-free program.  However, that a site contains a link to AT&amp;T&rsquo;s web
site for some other purpose (such as long-distance telephone service)
is not an objection against it.
</p>
<hr size="6">
<a name="GNU-Free-Documentation-License"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#References" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#References" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="GNU-Free-Documentation-License-1"></a>
<h1 class="appendix">A. GNU Free Documentation License</h1>

<a name="index-FDL_002c-GNU-Free-Documentation-License"></a>
<p align="center"> Version 1.3, 3 November 2008
</p>

<table><tr><td>&nbsp;</td><td><pre class="display">Copyright &copy; 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
<a href="http://fsf.org/">http://fsf.org/</a>

Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
</pre></td></tr></table>

<ol>
<li>
PREAMBLE

<p>The purpose of this License is to make a manual, textbook, or other
functional and useful document <em>free</em> in the sense of freedom: to
assure everyone the effective freedom to copy and redistribute it,
with or without modifying it, either commercially or noncommercially.
Secondarily, this License preserves for the author and publisher a way
to get credit for their work, while not being considered responsible
for modifications made by others.
</p>
<p>This License is a kind of &ldquo;copyleft&rdquo;, which means that derivative
works of the document must themselves be free in the same sense.  It
complements the GNU General Public License, which is a copyleft
license designed for free software.
</p>
<p>We have designed this License in order to use it for manuals for free
software, because free software needs free documentation: a free
program should come with manuals providing the same freedoms that the
software does.  But this License is not limited to software manuals;
it can be used for any textual work, regardless of subject matter or
whether it is published as a printed book.  We recommend this License
principally for works whose purpose is instruction or reference.
</p>
</li><li>
APPLICABILITY AND DEFINITIONS

<p>This License applies to any manual or other work, in any medium, that
contains a notice placed by the copyright holder saying it can be
distributed under the terms of this License.  Such a notice grants a
world-wide, royalty-free license, unlimited in duration, to use that
work under the conditions stated herein.  The &ldquo;Document&rdquo;, below,
refers to any such manual or work.  Any member of the public is a
licensee, and is addressed as &ldquo;you&rdquo;.  You accept the license if you
copy, modify or distribute the work in a way requiring permission
under copyright law.
</p>
<p>A &ldquo;Modified Version&rdquo; of the Document means any work containing the
Document or a portion of it, either copied verbatim, or with
modifications and/or translated into another language.
</p>
<p>A &ldquo;Secondary Section&rdquo; is a named appendix or a front-matter section
of the Document that deals exclusively with the relationship of the
publishers or authors of the Document to the Document&rsquo;s overall
subject (or to related matters) and contains nothing that could fall
directly within that overall subject.  (Thus, if the Document is in
part a textbook of mathematics, a Secondary Section may not explain
any mathematics.)  The relationship could be a matter of historical
connection with the subject or with related matters, or of legal,
commercial, philosophical, ethical or political position regarding
them.
</p>
<p>The &ldquo;Invariant Sections&rdquo; are certain Secondary Sections whose titles
are designated, as being those of Invariant Sections, in the notice
that says that the Document is released under this License.  If a
section does not fit the above definition of Secondary then it is not
allowed to be designated as Invariant.  The Document may contain zero
Invariant Sections.  If the Document does not identify any Invariant
Sections then there are none.
</p>
<p>The &ldquo;Cover Texts&rdquo; are certain short passages of text that are listed,
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
the Document is released under this License.  A Front-Cover Text may
be at most 5 words, and a Back-Cover Text may be at most 25 words.
</p>
<p>A &ldquo;Transparent&rdquo; copy of the Document means a machine-readable copy,
represented in a format whose specification is available to the
general public, that is suitable for revising the document
straightforwardly with generic text editors or (for images composed of
pixels) generic paint programs or (for drawings) some widely available
drawing editor, and that is suitable for input to text formatters or
for automatic translation to a variety of formats suitable for input
to text formatters.  A copy made in an otherwise Transparent file
format whose markup, or absence of markup, has been arranged to thwart
or discourage subsequent modification by readers is not Transparent.
An image format is not Transparent if used for any substantial amount
of text.  A copy that is not &ldquo;Transparent&rdquo; is called &ldquo;Opaque&rdquo;.
</p>
<p>Examples of suitable formats for Transparent copies include plain
ASCII without markup, Texinfo input format, LaTeX input
format, SGML or XML using a publicly available
DTD, and standard-conforming simple HTML,
PostScript or PDF designed for human modification.  Examples
of transparent image formats include PNG, XCF and
JPG.  Opaque formats include proprietary formats that can be
read and edited only by proprietary word processors, SGML or
XML for which the DTD and/or processing tools are
not generally available, and the machine-generated HTML,
PostScript or PDF produced by some word processors for
output purposes only.
</p>
<p>The &ldquo;Title Page&rdquo; means, for a printed book, the title page itself,
plus such following pages as are needed to hold, legibly, the material
this License requires to appear in the title page.  For works in
formats which do not have any title page as such, &ldquo;Title Page&rdquo; means
the text near the most prominent appearance of the work&rsquo;s title,
preceding the beginning of the body of the text.
</p>
<p>The &ldquo;publisher&rdquo; means any person or entity that distributes copies
of the Document to the public.
</p>
<p>A section &ldquo;Entitled XYZ&rdquo; means a named subunit of the Document whose
title either is precisely XYZ or contains XYZ in parentheses following
text that translates XYZ in another language.  (Here XYZ stands for a
specific section name mentioned below, such as &ldquo;Acknowledgements&rdquo;,
&ldquo;Dedications&rdquo;, &ldquo;Endorsements&rdquo;, or &ldquo;History&rdquo;.)  To &ldquo;Preserve the Title&rdquo;
of such a section when you modify the Document means that it remains a
section &ldquo;Entitled XYZ&rdquo; according to this definition.
</p>
<p>The Document may include Warranty Disclaimers next to the notice which
states that this License applies to the Document.  These Warranty
Disclaimers are considered to be included by reference in this
License, but only as regards disclaiming warranties: any other
implication that these Warranty Disclaimers may have is void and has
no effect on the meaning of this License.
</p>
</li><li>
VERBATIM COPYING

<p>You may copy and distribute the Document in any medium, either
commercially or noncommercially, provided that this License, the
copyright notices, and the license notice saying this License applies
to the Document are reproduced in all copies, and that you add no other
conditions whatsoever to those of this License.  You may not use
technical measures to obstruct or control the reading or further
copying of the copies you make or distribute.  However, you may accept
compensation in exchange for copies.  If you distribute a large enough
number of copies you must also follow the conditions in section 3.
</p>
<p>You may also lend copies, under the same conditions stated above, and
you may publicly display copies.
</p>
</li><li>
COPYING IN QUANTITY

<p>If you publish printed copies (or copies in media that commonly have
printed covers) of the Document, numbering more than 100, and the
Document&rsquo;s license notice requires Cover Texts, you must enclose the
copies in covers that carry, clearly and legibly, all these Cover
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
the back cover.  Both covers must also clearly and legibly identify
you as the publisher of these copies.  The front cover must present
the full title with all words of the title equally prominent and
visible.  You may add other material on the covers in addition.
Copying with changes limited to the covers, as long as they preserve
the title of the Document and satisfy these conditions, can be treated
as verbatim copying in other respects.
</p>
<p>If the required texts for either cover are too voluminous to fit
legibly, you should put the first ones listed (as many as fit
reasonably) on the actual cover, and continue the rest onto adjacent
pages.
</p>
<p>If you publish or distribute Opaque copies of the Document numbering
more than 100, you must either include a machine-readable Transparent
copy along with each Opaque copy, or state in or with each Opaque copy
a computer-network location from which the general network-using
public has access to download using public-standard network protocols
a complete Transparent copy of the Document, free of added material.
If you use the latter option, you must take reasonably prudent steps,
when you begin distribution of Opaque copies in quantity, to ensure
that this Transparent copy will remain thus accessible at the stated
location until at least one year after the last time you distribute an
Opaque copy (directly or through your agents or retailers) of that
edition to the public.
</p>
<p>It is requested, but not required, that you contact the authors of the
Document well before redistributing any large number of copies, to give
them a chance to provide you with an updated version of the Document.
</p>
</li><li>
MODIFICATIONS

<p>You may copy and distribute a Modified Version of the Document under
the conditions of sections 2 and 3 above, provided that you release
the Modified Version under precisely this License, with the Modified
Version filling the role of the Document, thus licensing distribution
and modification of the Modified Version to whoever possesses a copy
of it.  In addition, you must do these things in the Modified Version:
</p>
<ol>
<li>
Use in the Title Page (and on the covers, if any) a title distinct
from that of the Document, and from those of previous versions
(which should, if there were any, be listed in the History section
of the Document).  You may use the same title as a previous version
if the original publisher of that version gives permission.

</li><li>
List on the Title Page, as authors, one or more persons or entities
responsible for authorship of the modifications in the Modified
Version, together with at least five of the principal authors of the
Document (all of its principal authors, if it has fewer than five),
unless they release you from this requirement.

</li><li>
State on the Title page the name of the publisher of the
Modified Version, as the publisher.

</li><li>
Preserve all the copyright notices of the Document.

</li><li>
Add an appropriate copyright notice for your modifications
adjacent to the other copyright notices.

</li><li>
Include, immediately after the copyright notices, a license notice
giving the public permission to use the Modified Version under the
terms of this License, in the form shown in the Addendum below.

</li><li>
Preserve in that license notice the full lists of Invariant Sections
and required Cover Texts given in the Document&rsquo;s license notice.

</li><li>
Include an unaltered copy of this License.

</li><li>
Preserve the section Entitled &ldquo;History&rdquo;, Preserve its Title, and add
to it an item stating at least the title, year, new authors, and
publisher of the Modified Version as given on the Title Page.  If
there is no section Entitled &ldquo;History&rdquo; in the Document, create one
stating the title, year, authors, and publisher of the Document as
given on its Title Page, then add an item describing the Modified
Version as stated in the previous sentence.

</li><li>
Preserve the network location, if any, given in the Document for
public access to a Transparent copy of the Document, and likewise
the network locations given in the Document for previous versions
it was based on.  These may be placed in the &ldquo;History&rdquo; section.
You may omit a network location for a work that was published at
least four years before the Document itself, or if the original
publisher of the version it refers to gives permission.

</li><li>
For any section Entitled &ldquo;Acknowledgements&rdquo; or &ldquo;Dedications&rdquo;, Preserve
the Title of the section, and preserve in the section all the
substance and tone of each of the contributor acknowledgements and/or
dedications given therein.

</li><li>
Preserve all the Invariant Sections of the Document,
unaltered in their text and in their titles.  Section numbers
or the equivalent are not considered part of the section titles.

</li><li>
Delete any section Entitled &ldquo;Endorsements&rdquo;.  Such a section
may not be included in the Modified Version.

</li><li>
Do not retitle any existing section to be Entitled &ldquo;Endorsements&rdquo; or
to conflict in title with any Invariant Section.

</li><li>
Preserve any Warranty Disclaimers.
</li></ol>

<p>If the Modified Version includes new front-matter sections or
appendices that qualify as Secondary Sections and contain no material
copied from the Document, you may at your option designate some or all
of these sections as invariant.  To do this, add their titles to the
list of Invariant Sections in the Modified Version&rsquo;s license notice.
These titles must be distinct from any other section titles.
</p>
<p>You may add a section Entitled &ldquo;Endorsements&rdquo;, provided it contains
nothing but endorsements of your Modified Version by various
parties&mdash;for example, statements of peer review or that the text has
been approved by an organization as the authoritative definition of a
standard.
</p>
<p>You may add a passage of up to five words as a Front-Cover Text, and a
passage of up to 25 words as a Back-Cover Text, to the end of the list
of Cover Texts in the Modified Version.  Only one passage of
Front-Cover Text and one of Back-Cover Text may be added by (or
through arrangements made by) any one entity.  If the Document already
includes a cover text for the same cover, previously added by you or
by arrangement made by the same entity you are acting on behalf of,
you may not add another; but you may replace the old one, on explicit
permission from the previous publisher that added the old one.
</p>
<p>The author(s) and publisher(s) of the Document do not by this License
give permission to use their names for publicity for or to assert or
imply endorsement of any Modified Version.
</p>
</li><li>
COMBINING DOCUMENTS

<p>You may combine the Document with other documents released under this
License, under the terms defined in section 4 above for modified
versions, provided that you include in the combination all of the
Invariant Sections of all of the original documents, unmodified, and
list them all as Invariant Sections of your combined work in its
license notice, and that you preserve all their Warranty Disclaimers.
</p>
<p>The combined work need only contain one copy of this License, and
multiple identical Invariant Sections may be replaced with a single
copy.  If there are multiple Invariant Sections with the same name but
different contents, make the title of each such section unique by
adding at the end of it, in parentheses, the name of the original
author or publisher of that section if known, or else a unique number.
Make the same adjustment to the section titles in the list of
Invariant Sections in the license notice of the combined work.
</p>
<p>In the combination, you must combine any sections Entitled &ldquo;History&rdquo;
in the various original documents, forming one section Entitled
&ldquo;History&rdquo;; likewise combine any sections Entitled &ldquo;Acknowledgements&rdquo;,
and any sections Entitled &ldquo;Dedications&rdquo;.  You must delete all
sections Entitled &ldquo;Endorsements.&rdquo;
</p>
</li><li>
COLLECTIONS OF DOCUMENTS

<p>You may make a collection consisting of the Document and other documents
released under this License, and replace the individual copies of this
License in the various documents with a single copy that is included in
the collection, provided that you follow the rules of this License for
verbatim copying of each of the documents in all other respects.
</p>
<p>You may extract a single document from such a collection, and distribute
it individually under this License, provided you insert a copy of this
License into the extracted document, and follow this License in all
other respects regarding verbatim copying of that document.
</p>
</li><li>
AGGREGATION WITH INDEPENDENT WORKS

<p>A compilation of the Document or its derivatives with other separate
and independent documents or works, in or on a volume of a storage or
distribution medium, is called an &ldquo;aggregate&rdquo; if the copyright
resulting from the compilation is not used to limit the legal rights
of the compilation&rsquo;s users beyond what the individual works permit.
When the Document is included in an aggregate, this License does not
apply to the other works in the aggregate which are not themselves
derivative works of the Document.
</p>
<p>If the Cover Text requirement of section 3 is applicable to these
copies of the Document, then if the Document is less than one half of
the entire aggregate, the Document&rsquo;s Cover Texts may be placed on
covers that bracket the Document within the aggregate, or the
electronic equivalent of covers if the Document is in electronic form.
Otherwise they must appear on printed covers that bracket the whole
aggregate.
</p>
</li><li>
TRANSLATION

<p>Translation is considered a kind of modification, so you may
distribute translations of the Document under the terms of section 4.
Replacing Invariant Sections with translations requires special
permission from their copyright holders, but you may include
translations of some or all Invariant Sections in addition to the
original versions of these Invariant Sections.  You may include a
translation of this License, and all the license notices in the
Document, and any Warranty Disclaimers, provided that you also include
the original English version of this License and the original versions
of those notices and disclaimers.  In case of a disagreement between
the translation and the original version of this License or a notice
or disclaimer, the original version will prevail.
</p>
<p>If a section in the Document is Entitled &ldquo;Acknowledgements&rdquo;,
&ldquo;Dedications&rdquo;, or &ldquo;History&rdquo;, the requirement (section 4) to Preserve
its Title (section 1) will typically require changing the actual
title.
</p>
</li><li>
TERMINATION

<p>You may not copy, modify, sublicense, or distribute the Document
except as expressly provided under this License.  Any attempt
otherwise to copy, modify, sublicense, or distribute it is void, and
will automatically terminate your rights under this License.
</p>
<p>However, if you cease all violation of this License, then your license
from a particular copyright holder is reinstated (a) provisionally,
unless and until the copyright holder explicitly and finally
terminates your license, and (b) permanently, if the copyright holder
fails to notify you of the violation by some reasonable means prior to
60 days after the cessation.
</p>
<p>Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
</p>
<p>Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License.  If your rights have been terminated and not permanently
reinstated, receipt of a copy of some or all of the same material does
not give you any rights to use it.
</p>
</li><li>
FUTURE REVISIONS OF THIS LICENSE

<p>The Free Software Foundation may publish new, revised versions
of the GNU Free Documentation License from time to time.  Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.  See
<a href="http://www.gnu.org/copyleft/">http://www.gnu.org/copyleft/</a>.
</p>
<p>Each version of the License is given a distinguishing version number.
If the Document specifies that a particular numbered version of this
License &ldquo;or any later version&rdquo; applies to it, you have the option of
following the terms and conditions either of that specified version or
of any later version that has been published (not as a draft) by the
Free Software Foundation.  If the Document does not specify a version
number of this License, you may choose any version ever published (not
as a draft) by the Free Software Foundation.  If the Document
specifies that a proxy can decide which future versions of this
License can be used, that proxy&rsquo;s public statement of acceptance of a
version permanently authorizes you to choose that version for the
Document.
</p>
</li><li>
RELICENSING

<p>&ldquo;Massive Multiauthor Collaboration Site&rdquo; (or &ldquo;MMC Site&rdquo;) means any
World Wide Web server that publishes copyrightable works and also
provides prominent facilities for anybody to edit those works.  A
public wiki that anybody can edit is an example of such a server.  A
&ldquo;Massive Multiauthor Collaboration&rdquo; (or &ldquo;MMC&rdquo;) contained in the
site means any set of copyrightable works thus published on the MMC
site.
</p>
<p>&ldquo;CC-BY-SA&rdquo; means the Creative Commons Attribution-Share Alike 3.0
license published by Creative Commons Corporation, a not-for-profit
corporation with a principal place of business in San Francisco,
California, as well as future copyleft versions of that license
published by that same organization.
</p>
<p>&ldquo;Incorporate&rdquo; means to publish or republish a Document, in whole or
in part, as part of another Document.
</p>
<p>An MMC is &ldquo;eligible for relicensing&rdquo; if it is licensed under this
License, and if all works that were first published under this License
somewhere other than this MMC, and subsequently incorporated in whole
or in part into the MMC, (1) had no cover texts or invariant sections,
and (2) were thus incorporated prior to November 1, 2008.
</p>
<p>The operator of an MMC Site may republish an MMC contained in the site
under CC-BY-SA on the same site at any time before August 1, 2009,
provided the MMC is eligible for relicensing.
</p>
</li></ol>


<a name="ADDENDUM_003a-How-to-use-this-License-for-your-documents"></a>
<h2 class="heading">ADDENDUM: How to use this License for your documents</h2>

<p>To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and
license notices just after the title page:
</p>
<table><tr><td>&nbsp;</td><td><pre class="smallexample">  Copyright (C)  <var>year</var>  <var>your name</var>.
  Permission is granted to copy, distribute and/or modify this document
  under the terms of the GNU Free Documentation License, Version 1.3
  or any later version published by the Free Software Foundation;
  with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
  Texts.  A copy of the license is included in the section entitled ``GNU
  Free Documentation License''.
</pre></td></tr></table>

<p>If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
replace the &ldquo;with&hellip;Texts.&rdquo; line with this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="smallexample">    with the Invariant Sections being <var>list their titles</var>, with
    the Front-Cover Texts being <var>list</var>, and with the Back-Cover Texts
    being <var>list</var>.
</pre></td></tr></table>

<p>If you have Invariant Sections without Cover Texts, or some other
combination of the three, merge those two alternatives to suit the
situation.
</p>
<p>If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of
free software license, such as the GNU General Public License,
to permit their use in free software.
</p>


<hr size="6">
<a name="Index"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#GNU-Free-Documentation-License" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[ &gt; ]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#GNU-Free-Documentation-License" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[ &gt;&gt; ]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Index-1"></a>
<h1 class="unnumbered">Index</h1>
<table><tr><th valign="top">Jump to: &nbsp; </th><td><a href="#Index-1_cp_symbol-1" class="summary-letter"><b>#</b></a>
 &nbsp; 
<a href="#Index-1_cp_symbol-2" class="summary-letter"><b>-</b></a>
 &nbsp; 
<br>
<a href="#Index-1_cp_letter-A" class="summary-letter"><b>A</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-B" class="summary-letter"><b>B</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-C" class="summary-letter"><b>C</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-D" class="summary-letter"><b>D</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-E" class="summary-letter"><b>E</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-F" class="summary-letter"><b>F</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-G" class="summary-letter"><b>G</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-I" class="summary-letter"><b>I</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-K" class="summary-letter"><b>K</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-L" class="summary-letter"><b>L</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-M" class="summary-letter"><b>M</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-N" class="summary-letter"><b>N</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-O" class="summary-letter"><b>O</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-P" class="summary-letter"><b>P</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-Q" class="summary-letter"><b>Q</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-R" class="summary-letter"><b>R</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-S" class="summary-letter"><b>S</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-T" class="summary-letter"><b>T</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-U" class="summary-letter"><b>U</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-V" class="summary-letter"><b>V</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-W" class="summary-letter"><b>W</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-X" class="summary-letter"><b>X</b></a>
 &nbsp; 
</td></tr></table>
<table border="0" class="index-cp">
<tr><td></td><th align="left">Index Entry</th><th align="left"> Section</th></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Index-1_cp_symbol-1">#</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-_0023endif_002c-commenting"><code>#endif</code>, commenting</a></td><td valign="top"><a href="#Comments">5.2 Commenting Your Work</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Index-1_cp_symbol-2">-</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_002dhelp-output">&lsquo;<samp>--help</samp>&rsquo; output</a></td><td valign="top"><a href="#g_t_002d_002dhelp">4.7.2 &lsquo;<samp>--help</samp>&rsquo;</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002d_002dversion-output">&lsquo;<samp>--version</samp>&rsquo; output</a></td><td valign="top"><a href="#g_t_002d_002dversion">4.7.1 &lsquo;<samp>--version</samp>&rsquo;</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002dWall-compiler-option">&lsquo;<samp>-Wall</samp>&rsquo; compiler option</a></td><td valign="top"><a href="#Syntactic-Conventions">5.3 Clean Use of C Constructs</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Index-1_cp_letter-A">A</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-accepting-contributions">accepting contributions</a></td><td valign="top"><a href="#Contributions">2.2 Accepting Contributions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-address-for-bug-reports">address for bug reports</a></td><td valign="top"><a href="#g_t_002d_002dhelp">4.7.2 &lsquo;<samp>--help</samp>&rsquo;</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ANSI-C-standard"><small>ANSI</small> C standard</a></td><td valign="top"><a href="#Standard-C">3.4 Standard C and Pre-Standard C</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-arbitrary-limits-on-data">arbitrary limits on data</a></td><td valign="top"><a href="#Semantics">4.2 Writing Robust Programs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ASCII-characters">ASCII characters</a></td><td valign="top"><a href="#Character-Set">5.9 Character Set</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-autoconf"><code>autoconf</code></a></td><td valign="top"><a href="#System-Portability">5.5 Portability between System Types</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-avoiding-proprietary-code">avoiding proprietary code</a></td><td valign="top"><a href="#Reading-Non_002dFree-Code">2.1 Referring to Proprietary Programs</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Index-1_cp_letter-B">B</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-behavior_002c-dependent-on-program_0027s-name">behavior, dependent on program&rsquo;s name</a></td><td valign="top"><a href="#User-Interfaces">4.5 Standards for Interfaces Generally</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-binary-packages">binary packages</a></td><td valign="top"><a href="#Install-Command-Categories">7.2.7 Install Command Categories</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-bindir"><code>bindir</code></a></td><td valign="top"><a href="#Directory-Variables">7.2.5 Variables for Installation Directories</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-braces_002c-in-C-source">braces, in C source</a></td><td valign="top"><a href="#Formatting">5.1 Formatting Your Source Code</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-bug-reports">bug reports</a></td><td valign="top"><a href="#g_t_002d_002dhelp">4.7.2 &lsquo;<samp>--help</samp>&rsquo;</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-bug_002dstandards_0040gnu_002eorg-email-address"><code>bug-standards@gnu.org</code> email address</a></td><td valign="top"><a href="#Preface">1. About the GNU Coding Standards</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Index-1_cp_letter-C">C</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-C-library-functions_002c-and-portability">C library functions, and portability</a></td><td valign="top"><a href="#System-Functions">5.7 Calling System Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-canonical-name-of-a-program">canonical name of a program</a></td><td valign="top"><a href="#g_t_002d_002dversion">4.7.1 &lsquo;<samp>--version</samp>&rsquo;</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-casting-pointers-to-integers">casting pointers to integers</a></td><td valign="top"><a href="#CPU-Portability">5.6 Portability between <small>CPU</small>s</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-CGI-programs_002c-standard-options-for">CGI programs, standard options for</a></td><td valign="top"><a href="#Command_002dLine-Interfaces">4.7 Standards for Command Line Interfaces</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-change-logs">change logs</a></td><td valign="top"><a href="#Change-Logs">6.8 Change Logs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-change-logs_002c-conditional-changes">change logs, conditional changes</a></td><td valign="top"><a href="#Conditional-Changes">6.8.4 Conditional Changes</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-change-logs_002c-style">change logs, style</a></td><td valign="top"><a href="#Style-of-Change-Logs">6.8.2 Style of Change Logs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-character-set">character set</a></td><td valign="top"><a href="#Character-Set">5.9 Character Set</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-clang"><code>clang</code></a></td><td valign="top"><a href="#Syntactic-Conventions">5.3 Clean Use of C Constructs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-command_002dline-arguments_002c-decoding">command-line arguments, decoding</a></td><td valign="top"><a href="#Semantics">4.2 Writing Robust Programs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-command_002dline-interface">command-line interface</a></td><td valign="top"><a href="#Command_002dLine-Interfaces">4.7 Standards for Command Line Interfaces</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-commenting">commenting</a></td><td valign="top"><a href="#Comments">5.2 Commenting Your Work</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-compatibility-with-C-and-POSIX-standards">compatibility with C and <small>POSIX</small> standards</a></td><td valign="top"><a href="#Compatibility">3.2 Compatibility with Other Implementations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-compiler-warnings">compiler warnings</a></td><td valign="top"><a href="#Syntactic-Conventions">5.3 Clean Use of C Constructs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-conditional-changes_002c-and-change-logs">conditional changes, and change logs</a></td><td valign="top"><a href="#Conditional-Changes">6.8.4 Conditional Changes</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-conditionals_002c-comments-for">conditionals, comments for</a></td><td valign="top"><a href="#Comments">5.2 Commenting Your Work</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-configure"><code>configure</code></a></td><td valign="top"><a href="#Configuration">7.1 How Configuration Should Work</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-control_002dL">control-L</a></td><td valign="top"><a href="#Formatting">5.1 Formatting Your Source Code</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-conventions-for-makefiles">conventions for makefiles</a></td><td valign="top"><a href="#Makefile-Conventions">7.2 Makefile Conventions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-CORBA">CORBA</a></td><td valign="top"><a href="#Graphical-Interfaces">4.6 Standards for Graphical Interfaces</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-credits-for-manuals">credits for manuals</a></td><td valign="top"><a href="#Manual-Credits">6.5 Manual Credits</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Index-1_cp_letter-D">D</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-D_002dbus">D-bus</a></td><td valign="top"><a href="#Graphical-Interfaces">4.6 Standards for Graphical Interfaces</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-data-structures_002c-in-Gnulib"><code>data structures, in Gnulib</code></a></td><td valign="top"><a href="#System-Functions">5.7 Calling System Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-data-types_002c-and-portability">data types, and portability</a></td><td valign="top"><a href="#CPU-Portability">5.6 Portability between <small>CPU</small>s</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-DESTDIR"><code>DESTDIR</code></a></td><td valign="top"><a href="#DESTDIR">7.2.4 <code>DESTDIR</code>: Support for Staged Installs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-directories_002c-creating-installation">directories, creating installation</a></td><td valign="top"><a href="#Directory-Variables">7.2.5 Variables for Installation Directories</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-documentation">documentation</a></td><td valign="top"><a href="#Documentation">6. Documenting Programs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-doschk"><code>doschk</code></a></td><td valign="top"><a href="#Names">5.4 Naming Variables, Functions, and Files</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-downloading-this-manual">downloading this manual</a></td><td valign="top"><a href="#Preface">1. About the GNU Coding Standards</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-dynamic-plug_002dins">dynamic plug-ins</a></td><td valign="top"><a href="#Dynamic-Plug_002dIn-Interfaces">4.8 Standards for Dynamic Plug-in Interfaces</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Index-1_cp_letter-E">E</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-encodings">encodings</a></td><td valign="top"><a href="#Character-Set">5.9 Character Set</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-error-messages">error messages</a></td><td valign="top"><a href="#Semantics">4.2 Writing Robust Programs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-error-messages_002c-formatting">error messages, formatting</a></td><td valign="top"><a href="#Errors">4.4 Formatting Error Messages</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-error-messages_002c-in-Gnulib"><code>error messages, in Gnulib</code></a></td><td valign="top"><a href="#System-Functions">5.7 Calling System Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-exec_005fprefix"><code>exec_prefix</code></a></td><td valign="top"><a href="#Directory-Variables">7.2.5 Variables for Installation Directories</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-expressions_002c-splitting">expressions, splitting</a></td><td valign="top"><a href="#Formatting">5.1 Formatting Your Source Code</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Index-1_cp_letter-F">F</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-FDL_002c-GNU-Free-Documentation-License">FDL, GNU Free Documentation License</a></td><td valign="top"><a href="#GNU-Free-Documentation-License">A. GNU Free Documentation License</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file-usage">file usage</a></td><td valign="top"><a href="#File-Usage">4.12 File Usage</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002dname-limitations">file-name limitations</a></td><td valign="top"><a href="#Names">5.4 Naming Variables, Functions, and Files</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-formatting-error-messages">formatting error messages</a></td><td valign="top"><a href="#Errors">4.4 Formatting Error Messages</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-formatting-source-code">formatting source code</a></td><td valign="top"><a href="#Formatting">5.1 Formatting Your Source Code</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-formfeed">formfeed</a></td><td valign="top"><a href="#Formatting">5.1 Formatting Your Source Code</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-function-argument_002c-declaring">function argument, declaring</a></td><td valign="top"><a href="#Syntactic-Conventions">5.3 Clean Use of C Constructs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-function-prototypes">function prototypes</a></td><td valign="top"><a href="#Standard-C">3.4 Standard C and Pre-Standard C</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Index-1_cp_letter-G">G</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-getopt"><code>getopt</code></a></td><td valign="top"><a href="#Command_002dLine-Interfaces">4.7 Standards for Command Line Interfaces</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-gettext"><code>gettext</code></a></td><td valign="top"><a href="#Internationalization">5.8 Internationalization</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-GNOME">GNOME</a></td><td valign="top"><a href="#Graphical-Interfaces">4.6 Standards for Graphical Interfaces</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-GNOME-and-Guile">GNOME and Guile</a></td><td valign="top"><a href="#Source-Language">3.1 Which Languages to Use</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Gnulib">Gnulib</a></td><td valign="top"><a href="#System-Functions">5.7 Calling System Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-gnustandards-project-repository">gnustandards project repository</a></td><td valign="top"><a href="#Preface">1. About the GNU Coding Standards</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-gnustandards_002dcommit_0040gnu_002eorg-mailing-list"><code>gnustandards-commit@gnu.org</code> mailing list</a></td><td valign="top"><a href="#Preface">1. About the GNU Coding Standards</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-graphical-user-interface">graphical user interface</a></td><td valign="top"><a href="#Graphical-Interfaces">4.6 Standards for Graphical Interfaces</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-grave-accent">grave accent</a></td><td valign="top"><a href="#Quote-Characters">5.10 Quote Characters</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-GTK_002b">GTK+</a></td><td valign="top"><a href="#Graphical-Interfaces">4.6 Standards for Graphical Interfaces</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Guile">Guile</a></td><td valign="top"><a href="#Source-Language">3.1 Which Languages to Use</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Index-1_cp_letter-I">I</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-implicit-int">implicit <code>int</code></a></td><td valign="top"><a href="#Syntactic-Conventions">5.3 Clean Use of C Constructs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-impossible-conditions">impossible conditions</a></td><td valign="top"><a href="#Semantics">4.2 Writing Robust Programs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-installation-directories_002c-creating">installation directories, creating</a></td><td valign="top"><a href="#Directory-Variables">7.2.5 Variables for Installation Directories</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-installations_002c-staged">installations, staged</a></td><td valign="top"><a href="#DESTDIR">7.2.4 <code>DESTDIR</code>: Support for Staged Installs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-interface-styles">interface styles</a></td><td valign="top"><a href="#Graphical-Interfaces">4.6 Standards for Graphical Interfaces</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-internationalization">internationalization</a></td><td valign="top"><a href="#Internationalization">5.8 Internationalization</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Index-1_cp_letter-K">K</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-keyboard-interface">keyboard interface</a></td><td valign="top"><a href="#Graphical-Interfaces">4.6 Standards for Graphical Interfaces</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Index-1_cp_letter-L">L</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-LDAP">LDAP</a></td><td valign="top"><a href="#OID-Allocations">4.10 OID Allocations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-left-quote">left quote</a></td><td valign="top"><a href="#Quote-Characters">5.10 Quote Characters</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-legal-aspects">legal aspects</a></td><td valign="top"><a href="#Legal-Issues">2. Keeping Free Software Free</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-legal-papers">legal papers</a></td><td valign="top"><a href="#Contributions">2.2 Accepting Contributions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-libexecdir"><code>libexecdir</code></a></td><td valign="top"><a href="#Directory-Variables">7.2.5 Variables for Installation Directories</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-libiconv"><code>libiconv</code></a></td><td valign="top"><a href="#Semantics">4.2 Writing Robust Programs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-libraries">libraries</a></td><td valign="top"><a href="#Libraries">4.3 Library Behavior</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-library-functions_002c-and-portability">library functions, and portability</a></td><td valign="top"><a href="#System-Functions">5.7 Calling System Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-library-interface">library interface</a></td><td valign="top"><a href="#Graphical-Interfaces">4.6 Standards for Graphical Interfaces</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-license-for-manuals">license for manuals</a></td><td valign="top"><a href="#License-for-Manuals">6.4 License for Manuals</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-lint"><code>lint</code></a></td><td valign="top"><a href="#Syntactic-Conventions">5.3 Clean Use of C Constructs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-locale_002dspecific-quote-characters">locale-specific quote characters</a></td><td valign="top"><a href="#Quote-Characters">5.10 Quote Characters</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-long-option-names">long option names</a></td><td valign="top"><a href="#Option-Table">4.9 Table of Long Options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-long_002dnamed-options">long-named options</a></td><td valign="top"><a href="#Command_002dLine-Interfaces">4.7 Standards for Command Line Interfaces</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Index-1_cp_letter-M">M</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-makefile_002c-conventions-for">makefile, conventions for</a></td><td valign="top"><a href="#Makefile-Conventions">7.2 Makefile Conventions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-malloc-return-value"><code>malloc</code> return value</a></td><td valign="top"><a href="#Semantics">4.2 Writing Robust Programs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-man-pages">man pages</a></td><td valign="top"><a href="#Man-Pages">6.9 Man Pages</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-manual-structure">manual structure</a></td><td valign="top"><a href="#Manual-Structure-Details">6.3 Manual Structure Details</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-memory-allocation-failure">memory allocation failure</a></td><td valign="top"><a href="#Semantics">4.2 Writing Robust Programs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-memory-leak">memory leak</a></td><td valign="top"><a href="#Memory-Usage">4.11 Memory Usage</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-memory-usage">memory usage</a></td><td valign="top"><a href="#Memory-Usage">4.11 Memory Usage</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-message-text_002c-and-internationalization">message text, and internationalization</a></td><td valign="top"><a href="#Internationalization">5.8 Internationalization</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-mmap"><code>mmap</code></a></td><td valign="top"><a href="#Mmap">5.11 Mmap</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-multiple-variables-in-a-line">multiple variables in a line</a></td><td valign="top"><a href="#Syntactic-Conventions">5.3 Clean Use of C Constructs</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Index-1_cp_letter-N">N</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-names-of-variables_002c-functions_002c-and-files">names of variables, functions, and files</a></td><td valign="top"><a href="#Names">5.4 Naming Variables, Functions, and Files</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-NEWS-file">&lsquo;<tt>NEWS</tt>&rsquo; file</a></td><td valign="top"><a href="#NEWS-File">6.7 The NEWS File</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-non_002dASCII-characters">non-ASCII characters</a></td><td valign="top"><a href="#Character-Set">5.9 Character Set</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-non_002dPOSIX-systems_002c-and-portability">non-<small>POSIX</small> systems, and portability</a></td><td valign="top"><a href="#System-Portability">5.5 Portability between System Types</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-non_002dstandard-extensions">non-standard extensions</a></td><td valign="top"><a href="#Using-Extensions">3.3 Using Non-standard Features</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-NUL-characters"><code>NUL</code> characters</a></td><td valign="top"><a href="#Semantics">4.2 Writing Robust Programs</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Index-1_cp_letter-O">O</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-OID-allocations-for-GNU">OID allocations for GNU</a></td><td valign="top"><a href="#OID-Allocations">4.10 OID Allocations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-open-brace">open brace</a></td><td valign="top"><a href="#Formatting">5.1 Formatting Your Source Code</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-optional-features_002c-configure_002dtime">optional features, configure-time</a></td><td valign="top"><a href="#Configuration">7.1 How Configuration Should Work</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-options-for-compatibility">options for compatibility</a></td><td valign="top"><a href="#Compatibility">3.2 Compatibility with Other Implementations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-options_002c-standard-command_002dline">options, standard command-line</a></td><td valign="top"><a href="#Command_002dLine-Interfaces">4.7 Standards for Command Line Interfaces</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-output-device-and-program_0027s-behavior">output device and program&rsquo;s behavior</a></td><td valign="top"><a href="#User-Interfaces">4.5 Standards for Interfaces Generally</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Index-1_cp_letter-P">P</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-packaging">packaging</a></td><td valign="top"><a href="#Releases">7.3 Making Releases</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-PATH_005fINFO_002c-specifying-standard-options-as">PATH_INFO, specifying standard options as</a></td><td valign="top"><a href="#Command_002dLine-Interfaces">4.7 Standards for Command Line Interfaces</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-plug_002dins">plug-ins</a></td><td valign="top"><a href="#Dynamic-Plug_002dIn-Interfaces">4.8 Standards for Dynamic Plug-in Interfaces</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-plugin_005fis_005fGPL_005fcompatible"><code>plugin_is_GPL_compatible</code></a></td><td valign="top"><a href="#Dynamic-Plug_002dIn-Interfaces">4.8 Standards for Dynamic Plug-in Interfaces</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-portability_002c-and-data-types">portability, and data types</a></td><td valign="top"><a href="#CPU-Portability">5.6 Portability between <small>CPU</small>s</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-portability_002c-and-library-functions">portability, and library functions</a></td><td valign="top"><a href="#System-Functions">5.7 Calling System Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-portability_002c-between-system-types">portability, between system types</a></td><td valign="top"><a href="#System-Portability">5.5 Portability between System Types</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-POSIX-compatibility"><small>POSIX</small> compatibility</a></td><td valign="top"><a href="#Compatibility">3.2 Compatibility with Other Implementations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-POSIX-functions_002c-and-portability">POSIX functions, and portability</a></td><td valign="top"><a href="#System-Functions">5.7 Calling System Functions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-POSIXLY_005fCORRECT_002c-environment-variable"><code>POSIXLY_CORRECT</code>, environment variable</a></td><td valign="top"><a href="#Compatibility">3.2 Compatibility with Other Implementations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-post_002dinstallation-commands">post-installation commands</a></td><td valign="top"><a href="#Install-Command-Categories">7.2.7 Install Command Categories</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-pre_002dinstallation-commands">pre-installation commands</a></td><td valign="top"><a href="#Install-Command-Categories">7.2.7 Install Command Categories</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-prefix"><code>prefix</code></a></td><td valign="top"><a href="#Directory-Variables">7.2.5 Variables for Installation Directories</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-program-configuration">program configuration</a></td><td valign="top"><a href="#Configuration">7.1 How Configuration Should Work</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-program-design">program design</a></td><td valign="top"><a href="#Design-Advice">3. General Program Design</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-program-name-and-its-behavior">program name and its behavior</a></td><td valign="top"><a href="#User-Interfaces">4.5 Standards for Interfaces Generally</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-program_0027s-canonical-name">program&rsquo;s canonical name</a></td><td valign="top"><a href="#g_t_002d_002dversion">4.7.1 &lsquo;<samp>--version</samp>&rsquo;</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-programming-languages">programming languages</a></td><td valign="top"><a href="#Source-Language">3.1 Which Languages to Use</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-proprietary-programs">proprietary programs</a></td><td valign="top"><a href="#Reading-Non_002dFree-Code">2.1 Referring to Proprietary Programs</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Index-1_cp_letter-Q">Q</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-quote-characters">quote characters</a></td><td valign="top"><a href="#Quote-Characters">5.10 Quote Characters</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Index-1_cp_letter-R">R</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-README-file">&lsquo;<tt>README</tt>&rsquo; file</a></td><td valign="top"><a href="#Releases">7.3 Making Releases</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-references-to-non_002dfree-material">references to non-free material</a></td><td valign="top"><a href="#References">8. References to Non-Free Software and Documentation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-releasing">releasing</a></td><td valign="top"><a href="#Managing-Releases">7. The Release Process</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Index-1_cp_letter-S">S</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-Savannah-repository-for-gnustandards">Savannah repository for gnustandards</a></td><td valign="top"><a href="#Preface">1. About the GNU Coding Standards</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-sbindir"><code>sbindir</code></a></td><td valign="top"><a href="#Directory-Variables">7.2.5 Variables for Installation Directories</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-signal-handling">signal handling</a></td><td valign="top"><a href="#Semantics">4.2 Writing Robust Programs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-SNMP">SNMP</a></td><td valign="top"><a href="#OID-Allocations">4.10 OID Allocations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-spaces-before-open_002dparen">spaces before open-paren</a></td><td valign="top"><a href="#Formatting">5.1 Formatting Your Source Code</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-staged-installs">staged installs</a></td><td valign="top"><a href="#DESTDIR">7.2.4 <code>DESTDIR</code>: Support for Staged Installs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-standard-command_002dline-options">standard command-line options</a></td><td valign="top"><a href="#Command_002dLine-Interfaces">4.7 Standards for Command Line Interfaces</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-standards-for-makefiles">standards for makefiles</a></td><td valign="top"><a href="#Makefile-Conventions">7.2 Makefile Conventions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-syntactic-conventions">syntactic conventions</a></td><td valign="top"><a href="#Syntactic-Conventions">5.3 Clean Use of C Constructs</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Index-1_cp_letter-T">T</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-table-of-long-options">table of long options</a></td><td valign="top"><a href="#Option-Table">4.9 Table of Long Options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-temporary-files">temporary files</a></td><td valign="top"><a href="#Semantics">4.2 Writing Robust Programs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-temporary-variables">temporary variables</a></td><td valign="top"><a href="#Syntactic-Conventions">5.3 Clean Use of C Constructs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-texinfo_002etex_002c-in-a-distribution">&lsquo;<tt>texinfo.tex</tt>&rsquo;, in a distribution</a></td><td valign="top"><a href="#Releases">7.3 Making Releases</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-TMPDIR-environment-variable"><code>TMPDIR</code> environment variable</a></td><td valign="top"><a href="#Semantics">4.2 Writing Robust Programs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-trademarks">trademarks</a></td><td valign="top"><a href="#Trademarks">2.3 Trademarks</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Index-1_cp_letter-U">U</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-user-interface-styles">user interface styles</a></td><td valign="top"><a href="#Graphical-Interfaces">4.6 Standards for Graphical Interfaces</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Index-1_cp_letter-V">V</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-valgrind"><code>valgrind</code></a></td><td valign="top"><a href="#Memory-Usage">4.11 Memory Usage</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Index-1_cp_letter-W">W</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-where-to-obtain-standards_002etexi">where to obtain <code>standards.texi</code></a></td><td valign="top"><a href="#Preface">1. About the GNU Coding Standards</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
<tr><th><a name="Index-1_cp_letter-X">X</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-X_002e509">X.509</a></td><td valign="top"><a href="#OID-Allocations">4.10 OID Allocations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-xmalloc_002c-in-Gnulib"><code>xmalloc, in Gnulib</code></a></td><td valign="top"><a href="#System-Functions">5.7 Calling System Functions</a></td></tr>
<tr><td colspan="3"> <hr></td></tr>
</table>
<table><tr><th valign="top">Jump to: &nbsp; </th><td><a href="#Index-1_cp_symbol-1" class="summary-letter"><b>#</b></a>
 &nbsp; 
<a href="#Index-1_cp_symbol-2" class="summary-letter"><b>-</b></a>
 &nbsp; 
<br>
<a href="#Index-1_cp_letter-A" class="summary-letter"><b>A</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-B" class="summary-letter"><b>B</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-C" class="summary-letter"><b>C</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-D" class="summary-letter"><b>D</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-E" class="summary-letter"><b>E</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-F" class="summary-letter"><b>F</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-G" class="summary-letter"><b>G</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-I" class="summary-letter"><b>I</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-K" class="summary-letter"><b>K</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-L" class="summary-letter"><b>L</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-M" class="summary-letter"><b>M</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-N" class="summary-letter"><b>N</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-O" class="summary-letter"><b>O</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-P" class="summary-letter"><b>P</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-Q" class="summary-letter"><b>Q</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-R" class="summary-letter"><b>R</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-S" class="summary-letter"><b>S</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-T" class="summary-letter"><b>T</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-U" class="summary-letter"><b>U</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-V" class="summary-letter"><b>V</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-W" class="summary-letter"><b>W</b></a>
 &nbsp; 
<a href="#Index-1_cp_letter-X" class="summary-letter"><b>X</b></a>
 &nbsp; 
</td></tr></table>

<hr size="6">
<a name="SEC_Contents"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h1>Table of Contents</h1>
<div class="contents">

<ul class="toc">
  <li><a name="toc-About-the-GNU-Coding-Standards" href="#Preface">1. About the GNU Coding Standards</a></li>
  <li><a name="toc-Keeping-Free-Software-Free" href="#Legal-Issues">2. Keeping Free Software Free</a>
  <ul class="toc">
    <li><a name="toc-Referring-to-Proprietary-Programs" href="#Reading-Non_002dFree-Code">2.1 Referring to Proprietary Programs</a></li>
    <li><a name="toc-Accepting-Contributions" href="#Contributions">2.2 Accepting Contributions</a></li>
    <li><a name="toc-Trademarks-1" href="#Trademarks">2.3 Trademarks</a></li>
  </ul></li>
  <li><a name="toc-General-Program-Design" href="#Design-Advice">3. General Program Design</a>
  <ul class="toc">
    <li><a name="toc-Which-Languages-to-Use" href="#Source-Language">3.1 Which Languages to Use</a></li>
    <li><a name="toc-Compatibility-with-Other-Implementations" href="#Compatibility">3.2 Compatibility with Other Implementations</a></li>
    <li><a name="toc-Using-Non_002dstandard-Features" href="#Using-Extensions">3.3 Using Non-standard Features</a></li>
    <li><a name="toc-Standard-C-and-Pre_002dStandard-C" href="#Standard-C">3.4 Standard C and Pre-Standard C</a></li>
    <li><a name="toc-Conditional-Compilation-1" href="#Conditional-Compilation">3.5 Conditional Compilation</a></li>
  </ul></li>
  <li><a name="toc-Program-Behavior-for-All-Programs" href="#Program-Behavior">4. Program Behavior for All Programs</a>
  <ul class="toc">
    <li><a name="toc-Non_002dGNU-Standards-1" href="#Non_002dGNU-Standards">4.1 Non-GNU Standards</a></li>
    <li><a name="toc-Writing-Robust-Programs" href="#Semantics">4.2 Writing Robust Programs</a></li>
    <li><a name="toc-Library-Behavior" href="#Libraries">4.3 Library Behavior</a></li>
    <li><a name="toc-Formatting-Error-Messages" href="#Errors">4.4 Formatting Error Messages</a></li>
    <li><a name="toc-Standards-for-Interfaces-Generally" href="#User-Interfaces">4.5 Standards for Interfaces Generally</a></li>
    <li><a name="toc-Standards-for-Graphical-Interfaces" href="#Graphical-Interfaces">4.6 Standards for Graphical Interfaces</a></li>
    <li><a name="toc-Standards-for-Command-Line-Interfaces" href="#Command_002dLine-Interfaces">4.7 Standards for Command Line Interfaces</a>
    <ul class="toc">
      <li><a name="toc-_002d_002dversion-1" href="#g_t_002d_002dversion">4.7.1 &lsquo;<samp>--version</samp>&rsquo;</a></li>
      <li><a name="toc-_002d_002dhelp-1" href="#g_t_002d_002dhelp">4.7.2 &lsquo;<samp>--help</samp>&rsquo;</a></li>
    </ul></li>
    <li><a name="toc-Standards-for-Dynamic-Plug_002din-Interfaces" href="#Dynamic-Plug_002dIn-Interfaces">4.8 Standards for Dynamic Plug-in Interfaces</a></li>
    <li><a name="toc-Table-of-Long-Options" href="#Option-Table">4.9 Table of Long Options</a></li>
    <li><a name="toc-OID-Allocations-1" href="#OID-Allocations">4.10 OID Allocations</a></li>
    <li><a name="toc-Memory-Usage-1" href="#Memory-Usage">4.11 Memory Usage</a></li>
    <li><a name="toc-File-Usage-1" href="#File-Usage">4.12 File Usage</a></li>
  </ul></li>
  <li><a name="toc-Making-The-Best-Use-of-C" href="#Writing-C">5. Making The Best Use of C</a>
  <ul class="toc">
    <li><a name="toc-Formatting-Your-Source-Code" href="#Formatting">5.1 Formatting Your Source Code</a></li>
    <li><a name="toc-Commenting-Your-Work" href="#Comments">5.2 Commenting Your Work</a></li>
    <li><a name="toc-Clean-Use-of-C-Constructs" href="#Syntactic-Conventions">5.3 Clean Use of C Constructs</a></li>
    <li><a name="toc-Naming-Variables_002c-Functions_002c-and-Files" href="#Names">5.4 Naming Variables, Functions, and Files</a></li>
    <li><a name="toc-Portability-between-System-Types" href="#System-Portability">5.5 Portability between System Types</a></li>
    <li><a name="toc-Portability-between-CPUs" href="#CPU-Portability">5.6 Portability between <small>CPU</small>s</a></li>
    <li><a name="toc-Calling-System-Functions" href="#System-Functions">5.7 Calling System Functions</a></li>
    <li><a name="toc-Internationalization-1" href="#Internationalization">5.8 Internationalization</a></li>
    <li><a name="toc-Character-Set-1" href="#Character-Set">5.9 Character Set</a></li>
    <li><a name="toc-Quote-Characters-1" href="#Quote-Characters">5.10 Quote Characters</a></li>
    <li><a name="toc-Mmap-1" href="#Mmap">5.11 Mmap</a></li>
  </ul></li>
  <li><a name="toc-Documenting-Programs" href="#Documentation">6. Documenting Programs</a>
  <ul class="toc">
    <li><a name="toc-GNU-Manuals-1" href="#GNU-Manuals">6.1 GNU Manuals</a></li>
    <li><a name="toc-Doc-Strings-and-Manuals-1" href="#Doc-Strings-and-Manuals">6.2 Doc Strings and Manuals</a></li>
    <li><a name="toc-Manual-Structure-Details-1" href="#Manual-Structure-Details">6.3 Manual Structure Details</a></li>
    <li><a name="toc-License-for-Manuals-1" href="#License-for-Manuals">6.4 License for Manuals</a></li>
    <li><a name="toc-Manual-Credits-1" href="#Manual-Credits">6.5 Manual Credits</a></li>
    <li><a name="toc-Printed-Manuals-1" href="#Printed-Manuals">6.6 Printed Manuals</a></li>
    <li><a name="toc-The-NEWS-File" href="#NEWS-File">6.7 The NEWS File</a></li>
    <li><a name="toc-Change-Logs-1" href="#Change-Logs">6.8 Change Logs</a>
    <ul class="toc">
      <li><a name="toc-Change-Log-Concepts-1" href="#Change-Log-Concepts">6.8.1 Change Log Concepts</a></li>
      <li><a name="toc-Style-of-Change-Logs-1" href="#Style-of-Change-Logs">6.8.2 Style of Change Logs</a></li>
      <li><a name="toc-Simple-Changes-1" href="#Simple-Changes">6.8.3 Simple Changes</a></li>
      <li><a name="toc-Conditional-Changes-1" href="#Conditional-Changes">6.8.4 Conditional Changes</a></li>
      <li><a name="toc-Indicating-the-Part-Changed-1" href="#Indicating-the-Part-Changed">6.8.5 Indicating the Part Changed</a></li>
    </ul></li>
    <li><a name="toc-Man-Pages-1" href="#Man-Pages">6.9 Man Pages</a></li>
    <li><a name="toc-Reading-other-Manuals-1" href="#Reading-other-Manuals">6.10 Reading other Manuals</a></li>
  </ul></li>
  <li><a name="toc-The-Release-Process" href="#Managing-Releases">7. The Release Process</a>
  <ul class="toc">
    <li><a name="toc-How-Configuration-Should-Work" href="#Configuration">7.1 How Configuration Should Work</a></li>
    <li><a name="toc-Makefile-Conventions-1" href="#Makefile-Conventions">7.2 Makefile Conventions</a>
    <ul class="toc">
      <li><a name="toc-General-Conventions-for-Makefiles" href="#Makefile-Basics">7.2.1 General Conventions for Makefiles</a></li>
      <li><a name="toc-Utilities-in-Makefiles-1" href="#Utilities-in-Makefiles">7.2.2 Utilities in Makefiles</a></li>
      <li><a name="toc-Variables-for-Specifying-Commands" href="#Command-Variables">7.2.3 Variables for Specifying Commands</a></li>
      <li><a name="toc-DESTDIR_003a-Support-for-Staged-Installs" href="#DESTDIR">7.2.4 <code>DESTDIR</code>: Support for Staged Installs</a></li>
      <li><a name="toc-Variables-for-Installation-Directories" href="#Directory-Variables">7.2.5 Variables for Installation Directories</a></li>
      <li><a name="toc-Standard-Targets-for-Users" href="#Standard-Targets">7.2.6 Standard Targets for Users</a></li>
      <li><a name="toc-Install-Command-Categories-1" href="#Install-Command-Categories">7.2.7 Install Command Categories</a></li>
    </ul></li>
    <li><a name="toc-Making-Releases" href="#Releases">7.3 Making Releases</a></li>
  </ul></li>
  <li><a name="toc-References-to-Non_002dFree-Software-and-Documentation" href="#References">8. References to Non-Free Software and Documentation</a></li>
  <li><a name="toc-GNU-Free-Documentation-License-1" href="#GNU-Free-Documentation-License">A. GNU Free Documentation License</a></li>
  <li><a name="toc-Index-1" href="#Index">Index</a></li>
</ul>
</div>
<hr size="1">
<a name="SEC_About"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="#Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h1>About This Document</h1>
<p>
  This document was generated by <em>Dustin Dorroh</em> on <em>August 29, 2011</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.82</em></a>.
</p>
<p>
  The buttons in the navigation panels have the following meaning:
</p>
<table border="1">
  <tr>
    <th> Button </th>
    <th> Name </th>
    <th> Go to </th>
    <th> From 1.2.3 go to</th>
  </tr>
  <tr>
    <td align="center"> [ &lt; ] </td>
    <td align="center">Back</td>
    <td>Previous section in reading order</td>
    <td>1.2.2</td>
  </tr>
  <tr>
    <td align="center"> [ &gt; ] </td>
    <td align="center">Forward</td>
    <td>Next section in reading order</td>
    <td>1.2.4</td>
  </tr>
  <tr>
    <td align="center"> [ &lt;&lt; ] </td>
    <td align="center">FastBack</td>
    <td>Beginning of this chapter or previous chapter</td>
    <td>1</td>
  </tr>
  <tr>
    <td align="center"> [ Up ] </td>
    <td align="center">Up</td>
    <td>Up section</td>
    <td>1.2</td>
  </tr>
  <tr>
    <td align="center"> [ &gt;&gt; ] </td>
    <td align="center">FastForward</td>
    <td>Next chapter</td>
    <td>2</td>
  </tr>
  <tr>
    <td align="center"> [Top] </td>
    <td align="center">Top</td>
    <td>Cover (top) of document</td>
    <td> &nbsp; </td>
  </tr>
  <tr>
    <td align="center"> [Contents] </td>
    <td align="center">Contents</td>
    <td>Table of contents</td>
    <td> &nbsp; </td>
  </tr>
  <tr>
    <td align="center"> [Index] </td>
    <td align="center">Index</td>
    <td>Index</td>
    <td> &nbsp; </td>
  </tr>
  <tr>
    <td align="center"> [ ? ] </td>
    <td align="center">About</td>
    <td>About (help)</td>
    <td> &nbsp; </td>
  </tr>
</table>

<p>
  where the <strong> Example </strong> assumes that the current position is at <strong> Subsubsection One-Two-Three </strong> of a document of the following structure:
</p>

<ul>
  <li> 1. Section One
    <ul>
      <li>1.1 Subsection One-One
        <ul>
          <li>...</li>
        </ul>
      </li>
      <li>1.2 Subsection One-Two
        <ul>
          <li>1.2.1 Subsubsection One-Two-One</li>
          <li>1.2.2 Subsubsection One-Two-Two</li>
          <li>1.2.3 Subsubsection One-Two-Three &nbsp; &nbsp;
            <strong>&lt;== Current Position </strong></li>
          <li>1.2.4 Subsubsection One-Two-Four</li>
        </ul>
      </li>
      <li>1.3 Subsection One-Three
        <ul>
          <li>...</li>
        </ul>
      </li>
      <li>1.4 Subsection One-Four</li>
    </ul>
  </li>
</ul>

<hr size="1">
<p>
 <font size="-1">
  This document was generated by <em>Dustin Dorroh</em> on <em>August 29, 2011</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.82</em></a>.
 </font>
 <br>

</p>
</body>
</html>
